swagger-jaxrs-doclet icon indicating copy to clipboard operation
swagger-jaxrs-doclet copied to clipboard

Support Jackson @JsonView filtering on return types

Open frankgrimes97 opened this issue 11 years ago • 2 comments

We often define a single structure but return subsets of its fields from different JAX-RS resource methods by annotating the methods with @JsonView. (FYI, we're actually using Dropwizard)

e.g. http://jira.codehaus.org/browse/JACKSON-578

Would it be possible for the generated swagger documentation to only include those fields which are included in the specified JsonView?

frankgrimes97 avatar Aug 22 '13 14:08 frankgrimes97

There is a workaround implemented in the carmapublic fork allowing you to override the type for documentation puposes. See https://github.com/ryankennedy/swagger-jaxrs-doclet/issues/63. In our project we have extended it to support interfaces too, as we are using Interfaces for jsonviews to leverage multiple inheritance.

cviebig avatar Aug 04 '14 12:08 cviebig

@cviebig ive just committed support for json view to https://github.com/Carma-Public/swagger-jaxrs-doclet ive added a test fixture for it too that uses interfaces and classes for the view classes based on the Person example in the original jackson ticket. let me know if its ok for you.

conorroche avatar Aug 14 '14 09:08 conorroche