[ 
https://issues.apache.org/jira/browse/CXF-8423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17285596#comment-17285596
 ] 

Andriy Redko commented on CXF-8423:
-----------------------------------

[~mksplg] this is sadly a Swagger 1.6.x issue, not CXF one. The 
io.swagger.jaxrs.Reader does not take the super classes / interfaces into 
account when building the model:
{code:java}
...
            // merge consumes, produces
            if (consumes.length == 0 && cls.getAnnotation(Consumes.class) != 
null) {
                consumes = 
ReaderUtils.splitContentValues(cls.getAnnotation(Consumes.class).value());
            }
            if (produces.length == 0 && cls.getAnnotation(Produces.class) != 
null) {
                produces = 
ReaderUtils.splitContentValues(cls.getAnnotation(Produces.class).value());
            }
 ...{code}
Please open an issue on Swagger Core s[1] side, we could help to fix it.

[1] https://github.com/swagger-api/swagger-core


 

> cxf-rt-rs-service-description-swagger ignores class level @Consumes and 
> @Produces annotation
> --------------------------------------------------------------------------------------------
>
>                 Key: CXF-8423
>                 URL: https://issues.apache.org/jira/browse/CXF-8423
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.4.2
>         Environment: org.apache.cxf:cxf-spring-boot-starter-jaxrs:3.4.1
> Spring Boot 2.3.5.RELEASE
>            Reporter: Markus Plangg
>            Priority: Minor
>
> Setting a @javax.ws.rs.Consumes or @javax.ws.rs.Produces annotation on an 
> interface applies the annotations to all methods.
>  
> I am using  in a Spring Boot project.
>  
> When I add the @Consumes and @Produces annotations to the interface, the 
> generated swagger.json file does not contain a "consumes" and "produces" 
> section for any method of the class.
>  
> When I add the annotations to any methods directly, they contain the correct 
> sections.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to