Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for @JsonView #797

Closed
daltonconley opened this issue Sep 5, 2022 · 3 comments
Closed

Add support for @JsonView #797

daltonconley opened this issue Sep 5, 2022 · 3 comments

Comments

@daltonconley
Copy link

daltonconley commented Sep 5, 2022

Feature description

It appears there is no support for @JsonView annotation. This was added to swagger-core in swagger-api/swagger-core#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.

@kevin-wise
Copy link

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

@daltonconley
Copy link
Author

@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.

@altro3
Copy link
Collaborator

altro3 commented Sep 21, 2022

@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

altro3 added a commit to altro3/micronaut-openapi that referenced this issue Jul 13, 2023
altro3 added a commit to altro3/micronaut-openapi that referenced this issue Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants