micronaut-openapi
micronaut-openapi copied to clipboard
Add support for @JsonView
Feature description
It appears there is no support for @JsonView
annotation. This was added to swagger-core in https://github.com/swagger-api/swagger-core/pull/2662
I'd like to be able to exclude certain fields from the response body schema based on the @JsonView
configuration but they get added to the schema regardless of the annotation now so both of my responses with the same object, but different views have the exact same schema.
Have you tried specific names for the different schemas? It might be you are hitting the problem documented in https://micronaut-projects.github.io/micronaut-openapi/latest/guide/#schemasNaming
...if you have two properties of same type with @Schema annotation without name set, Micronaut will accidentally override one definition with another
@kevin-wise Just did a bit of testing. I don't believe that is the issue I am seeing. I would also expect there be some reference to JsonView within this repo, but there doesn't appear to be.
My current workaround is to define a different class based on my view and supply that as the schema implementation class.
@daltonconley I understand what you're talking about, but it would be very nice if you create a repository with an example of what you want to see so that I can immediately test JsonView support