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

OAS3: how to exclude fields in POST operation but not in PUT operation, referencing the same implementation class #3418

Open
kremers opened this issue Jan 16, 2020 · 0 comments

Comments

@kremers
Copy link

@kremers kremers commented Jan 16, 2020

Hi there, I am working with the annotations https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations

How to create operations that refers to an implementation of some class like @Schema(implementation=....) offering the ID field in case of a PUT and hiding the ID field in case of a POST?

Since ID generation in POST should be up to the server. A PUT should result in 1:1 representation with GET so ID management is up to the client (processing a create or update at server side)

For POST I like to have something like: @Schema(implementation=MyClass.class, hidden="id")
for PUT the full @Schema(implementation=MyClass.class) is ok

I know that I can set @hidden in MyClass.java, but this will disable the field in both PUT and POST.
I can't set it to ReadOnly on MyClass level as well, since PUT needs to write the field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.