[jira] [Resolved] (CXF-7637) Using SwaggerToOpenApiConversionFilter with JAXRS extension mappings will never engage the filter

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

[jira] [Resolved] (CXF-7637) Using SwaggerToOpenApiConversionFilter with JAXRS extension mappings will never engage the filter

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/CXF-7637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-7637.
-----------------------------------
       Resolution: Fixed
         Assignee: Sergey Beryozkin
    Fix Version/s: 3.2.2
                   3.1.15

I've added an 'openApiJsonPath' property which can be used to customize

> Using SwaggerToOpenApiConversionFilter with JAXRS extension mappings will never engage the filter
> -------------------------------------------------------------------------------------------------
>
>                 Key: CXF-7637
>                 URL: https://issues.apache.org/jira/browse/CXF-7637
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.2.1
>            Reporter: Niels Bertram
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>             Fix For: 3.1.15, 3.2.2
>
>
> Using the {{SwaggerToOpenApiConversionFilter}} with {{JAXRSServerFactoryBean.setExtensionMappings()}} will stop the filter from executing even if the correct path is called. I think this is caused by the filter calling [reqCtx.getUriInfo().getPath()|https://github.com/apache/cxf/blob/9f727a9e1cbc5df87b752a3b7aa4bca94357e613/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionFilter.java#L45] which when extension mapping is enabled, will strip off the {{.json}} or any other extensions and then set the path to {{openapi}} only, which does not match the hard coded value {{openapi.json}}.
> Not sure but looks to me that it is probably not a bad idea to strip the extension (i.e. json, yml, yaml etc.) off the path and then compare just {{openapi}}.
> Basic configuration that should trigger this bug.
> {code:java}
>   @Bean
>   public Server rsServer(JacksonJsonProvider jsonProvider) {
>     JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
>     // enable the use of .json, .yaml or .xml extensions on the resource path
>     endpoint.setExtensionMappings(new HashMap<Object, Object>() {{
>       put("json", "application/json");
>       put("yml", "application/yaml");
>       put("yaml", "application/yaml");
>       put("xml", "application/xml");
>     }});
>     endpoint.setProvider(openApiConversionFilter());
>      ...
>     return endpoint.create();
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)