[GitHub] [cxf] coheigea opened a new pull request #679: CXF-8300 - Swagger2Feature displays cached API when service is redepl…

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [cxf] coheigea opened a new pull request #679: CXF-8300 - Swagger2Feature displays cached API when service is redepl…

GitBox

coheigea opened a new pull request #679:
URL: https://github.com/apache/cxf/pull/679


   …oyed
   
   The idea behind the fix is to update the Swagger2Feature.ServletConfigProvider to return a random UUID for SwaggerContextService.CONFIG_ID_KEY. In Swaggers BaseApiListingResource, it will return the cached Swagger API if the initializedConfig map already contains this Id:
   
   `if (SwaggerContextService.isConfigIdInitParamDefined(sc)) {
                       if (!initializedConfig.containsKey(sc.getServletName() + "_" + SwaggerContextService.getConfigIdFromInitParam(sc))) {
                           swagger = scan(app, servletContext, sc, uriInfo);
                       }
                   } `
   When the service is redeployed, the ServletConfigProvider will be added with a different random Id, which will force a reload of the Swagger document in BaseApiListingResource.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [cxf] reta commented on a change in pull request #679: CXF-8300 - Swagger2Feature displays cached API when service is redepl…

GitBox

reta commented on a change in pull request #679:
URL: https://github.com/apache/cxf/pull/679#discussion_r437681480



##########
File path: rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
##########
@@ -576,6 +577,8 @@ public String findSwaggerUiRoot() {
 
         private class ServletConfigProvider implements ContextProvider<ServletConfig> {
 
+            private String id = UUID.randomUUID().toString();

Review comment:
       :+1: We use similar technique in OpenAPI feature as well




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [cxf] coheigea merged pull request #679: CXF-8300 - Swagger2Feature displays cached API when service is redepl…

GitBox
In reply to this post by GitBox

coheigea merged pull request #679:
URL: https://github.com/apache/cxf/pull/679


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]