[cxf] branch 3.1.x-fixes updated: [CXF-7637] Making openapi json path configurable

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[cxf] branch 3.1.x-fixes updated: [CXF-7637] Making openapi json path configurable

sergeyb
This is an automated email from the ASF dual-hosted git repository.

sergeyb pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.1.x-fixes by this push:
     new abdad0d  [CXF-7637] Making openapi json path configurable
abdad0d is described below

commit abdad0d5458034507d7eab40cf7dc41c931b197d
Author: Sergey Beryozkin <[hidden email]>
AuthorDate: Wed Feb 7 12:37:53 2018 +0000

    [CXF-7637] Making openapi json path configurable
---
 .../jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java
index 3da18a4..56fac8c 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java
@@ -45,10 +45,12 @@ public final class SwaggerToOpenApiConversionFilter implements ContainerRequestF
     private static final String OPEN_API_PROPERTY = "openapi";
 
     private OpenApiConfiguration openApiConfig;
+    private String openApiJsonPath = OPEN_API_PATH;
+    
     @Override
     public void filter(ContainerRequestContext reqCtx) throws IOException {
         String path = reqCtx.getUriInfo().getPath();
-        if (path.endsWith(OPEN_API_PATH)) {
+        if (path.endsWith(openApiJsonPath)) {
             reqCtx.setRequestUri(URI.create(SWAGGER_PATH));
             JAXRSUtils.getCurrentMessage().getExchange().put(OPEN_API_PROPERTY, Boolean.TRUE);
         }
@@ -88,4 +90,8 @@ public final class SwaggerToOpenApiConversionFilter implements ContainerRequestF
     private boolean isOpenApiRequested() {
         return Boolean.TRUE == JAXRSUtils.getCurrentMessage().getExchange().get(OPEN_API_PROPERTY);
     }
+
+    public void setOpenApiJsonPath(String openApiJsonPath) {
+        this.openApiJsonPath = openApiJsonPath;
+    }
 }

--
To stop receiving notification emails like this one, please contact
[hidden email].