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

[BUG] [Java] [JaxRS] readOnly parameter breaks reading response #10663

Open
1 of 6 tasks
hoa8Be8v opened this issue Oct 22, 2021 · 0 comments
Open
1 of 6 tasks

[BUG] [Java] [JaxRS] readOnly parameter breaks reading response #10663

hoa8Be8v opened this issue Oct 22, 2021 · 0 comments

Comments

@hoa8Be8v
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

#9276 implemented "readOnly" by generating the annotation "JsonProperty.Access.READ_ONLY".

readOnly (OpenAPI): a property which can be sent in a response but not in a request.
JsonProperty.Access.READ_ONLY: property is ignored on deserialization.

These are differnet things. So on reading a response, properties marked as readOnly are not deserialized by jackson and are always null. This breaks all schemas that contain readOnly-properties because those properties are never deserialized. The same is probably true for writeOnly when trying to read requests.

Might be I simply don't understand something here, but how are you supposed to use this? Dont use readOnly? Create separate schemas for server and client?

openapi-generator version

5.2.1

Related issues/PRs

#9222

Suggest a fix

Don't generate "JsonProperty.Access.READ_ONLY" because it has different semantics from OpenAPI's "readOnly".

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

No branches or pull requests

1 participant