diff --git a/pom.xml b/pom.xml
index 94f096c..a7d67e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -112,6 +112,12 @@
hapi-fhir-jpaserver-mdm
${project.version}
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-server-openapi
+ ${project.version}
+
ca.uhn.hapi.fhir
diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java
index fd92001..87b4181 100644
--- a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java
+++ b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java
@@ -22,6 +22,7 @@ import java.util.Objects;
public class AppProperties {
private Boolean cql_enabled = false;
+ private Boolean openapi_enabled = false;
private Boolean mdm_enabled = false;
private Boolean allow_cascading_deletes = false;
private Boolean allow_contains_searches = true;
@@ -75,6 +76,14 @@ public class AppProperties {
private Boolean use_apache_address_strategy = false;
private Boolean use_apache_address_strategy_https = false;
+ public Boolean getOpenapi_enabled() {
+ return openapi_enabled;
+ }
+
+ public void setOpenapi_enabled(Boolean openapi_enabled) {
+ this.openapi_enabled = openapi_enabled;
+ }
+
public Boolean getUse_apache_address_strategy() {
return use_apache_address_strategy;
}
diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java b/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java
index dc16873..b58c41c 100644
--- a/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java
+++ b/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java
@@ -28,6 +28,7 @@ import ca.uhn.fhir.mdm.provider.MdmProviderLoader;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.narrative.INarrativeGenerator;
import ca.uhn.fhir.narrative2.NullNarrativeGenerator;
+import ca.uhn.fhir.rest.openapi.OpenApiInterceptor;
import ca.uhn.fhir.rest.server.ApacheProxyAddressStrategy;
import ca.uhn.fhir.rest.server.ETagSupportEnum;
import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy;
@@ -357,6 +358,10 @@ public class BaseJpaRestfulServer extends RestfulServer {
daoConfig.setDeferIndexingForCodesystemsOfSize(appProperties.getDefer_indexing_for_codesystems_of_size());
+ if (appProperties.getOpenapi_enabled()) {
+ registerInterceptor(new OpenApiInterceptor());
+ }
+
// Bulk Export
if (appProperties.getBulk_export_enabled()) {
registerProvider(bulkDataExportProvider);
diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml
index c4c393d..1c51699 100644
--- a/src/main/resources/application.yaml
+++ b/src/main/resources/application.yaml
@@ -36,6 +36,8 @@ spring:
allow-bean-definition-overriding: true
hapi:
fhir:
+ ### This enables the swagger-ui at /fhir/swagger-ui/index.html as well as the /fhir/api-docs (see https://hapifhir.io/hapi-fhir/docs/server_plain/openapi.html)
+ openapi_enabled: true
### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5
fhir_version: R4
### enable to use the ApacheProxyAddressStrategy which uses X-Forwarded-* headers