Skip to content

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

@harrybra

Description

@harrybra

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions