Added OpenAPI / Swagger option

This commit is contained in:
jkv
2021-11-10 20:57:31 +01:00
parent eaffce0d42
commit ea3f10ec86
4 changed files with 22 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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