Skip to content

Possibility to create setters for readOnly fields #1138

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

Open
Tomnivore opened this issue May 12, 2025 · 3 comments
Open

Possibility to create setters for readOnly fields #1138

Tomnivore opened this issue May 12, 2025 · 3 comments
Labels
area:client This item is related to the client extension

Comments

@Tomnivore
Copy link

Tell us the extension to which you'd like to add the feature.

Client

What kind of feature would you like to add?

Sometimes one "has" to use an OpenAPI schema for model creation in projects not directly associated with the given API. It would be nice to be able to create the models with setters without manually editing the schema or trying to edit the generation template (which is discouraged in the documentation).

Proposal(s):

Perhaps a config such as quarkus.openapi-generator.codegen.spec."source".read-only-setters=true.

Alternative(s):

No response

Additional info:

No response

Community Notes

  • Please vote by adding a 👍 reaction to the feature to help us prioritize.
  • If you want to work on this feature, please leave a comment.
@ricardozanini ricardozanini added the area:client This item is related to the client extension label May 12, 2025
@ricardozanini
Copy link
Member

Can you please add more details? Adding a "read-only" setter sounds unintuitive, almost like an anti-pattern.

@Tomnivore
Copy link
Author

It might be something that I actually should be able to do with configuring my Jackson object mapper, but anyways the case is the following. We have multiple projects using the same openapi schema, some of them communicate with API and such but some use just the model and receive the data from MongoDB, which makes it so that the setter less field won't be deserialized to the models.

@ricardozanini
Copy link
Member

I'm sorry, but this seems like an edge case. I don't really see the value of this feature in this extension. Can't you configure your marshallers or have a version of the spec without the model you are not interested in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:client This item is related to the client extension
Projects
None yet
Development

No branches or pull requests

2 participants