diff --git a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java index e6ffcdfe8c9..e3fec55806f 100644 --- a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java +++ b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java @@ -126,20 +126,11 @@ public class OpenApiInterceptor { private final Map myResourcePathToClasspath = new HashMap<>(); private final Map myExtensionToContentType = new HashMap<>(); private String myBannerImage; - private final boolean myShowPartitionPrefix; - - // FIXME KZ delete this? Or figure out a better way to pass the configuration in. - public OpenApiInterceptor() { - this(false,null); - } /** * Constructor */ - public OpenApiInterceptor(boolean theRequestPartitionFlag, String theDefaultPartitionName) { - // FIXME MB how to configure? Do we know the default partition name? - myShowPartitionPrefix = theRequestPartitionFlag; - + public OpenApiInterceptor() { mySwaggerUiVersion = initSwaggerUiWebJar(); myTemplateEngine = new TemplateEngine(); @@ -752,19 +743,9 @@ public class OpenApiInterceptor { } } - private Operation getPathItem(Paths thePaths, String thePath, PathItem.HttpMethod theMethod) { + protected Operation getPathItem(Paths thePaths, String thePath, PathItem.HttpMethod theMethod) { PathItem pathItem; - String partitionPrefix; - Operation newOperation = new Operation(); - - if (myShowPartitionPrefix) { - partitionPrefix = "/{partitionId}"; - addPartitionNameParameter(newOperation); - } else { - partitionPrefix = ""; - } - thePath = partitionPrefix + thePath; if (thePaths.containsKey(thePath)) { pathItem = thePaths.get(thePath); } else { @@ -775,19 +756,19 @@ public class OpenApiInterceptor { switch (theMethod) { case POST: assert pathItem.getPost() == null : "Have duplicate POST at path: " + thePath; - return pathItem.post(newOperation).getPost(); + return pathItem.post(new Operation()).getPost(); case GET: assert pathItem.getGet() == null : "Have duplicate GET at path: " + thePath; - return pathItem.get(newOperation).getGet(); + return pathItem.get(new Operation()).getGet(); case PUT: assert pathItem.getPut() == null; - return pathItem.put(newOperation).getPut(); + return pathItem.put(new Operation()).getPut(); case PATCH: assert pathItem.getPatch() == null; - return pathItem.patch(newOperation).getPatch(); + return pathItem.patch(new Operation()).getPatch(); case DELETE: assert pathItem.getDelete() == null; - return pathItem.delete(newOperation).getDelete(); + return pathItem.delete(new Operation()).getDelete(); case HEAD: case OPTIONS: case TRACE: @@ -864,18 +845,6 @@ public class OpenApiInterceptor { theOperation.addParametersItem(parameter); } - private void addPartitionNameParameter(Operation theOperation) { - Parameter parameter = new Parameter(); - parameter.setName("partition_name"); - // FIXME MB only if request mode - parameter.setIn("path"); - parameter.setDescription("The name of the partition to target"); - parameter.setExample("DEFAULT"); - parameter.setSchema(new Schema().type("string").minimum(new BigDecimal(1))); - parameter.setStyle(Parameter.StyleEnum.SIMPLE); - theOperation.addParametersItem(parameter); - } - protected ClassLoaderTemplateResource getIndexTemplate() { return new ClassLoaderTemplateResource(myResourcePathToClasspath.get("/swagger-ui/index.html"), StandardCharsets.UTF_8.name()); }