Skip to content

Fix so that the normalizer retains the read/write only attribute#21737

Merged
wing328 merged 1 commit intoOpenAPITools:masterfrom
Mattias-Sehlstedt:anyof-normalization-keep-read-write-only-attribute
Aug 17, 2025
Merged

Fix so that the normalizer retains the read/write only attribute#21737
wing328 merged 1 commit intoOpenAPITools:masterfrom
Mattias-Sehlstedt:anyof-normalization-keep-read-write-only-attribute

Conversation

@Mattias-Sehlstedt
Copy link
Copy Markdown
Contributor

Fixes #21732.

I have added so that it keeps ReadOnly and WriteOnly, but it might be that one should even run copyMetadata?

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Copy Markdown
Member

wing328 commented Aug 13, 2025

but it might be that one should even run copyMetadata?

what do you mean by that? do you mean we should also handle other meta data in addition to readonly, writeonly?

@Mattias-Sehlstedt
Copy link
Copy Markdown
Contributor Author

but it might be that one should even run copyMetadata?

what do you mean by that? do you mean we should also handle other meta data in addition to readonly, writeonly?

I was just wondering, without putting too much thought into it, whether there are additional attributes that might be relevant to keep when doing the normalization.

@Mattias-Sehlstedt Mattias-Sehlstedt marked this pull request as draft August 13, 2025 16:16
@Mattias-Sehlstedt
Copy link
Copy Markdown
Contributor Author

Converted to draft since I see now that this not really represent the issue reported, will look further into it.

@Mattias-Sehlstedt Mattias-Sehlstedt force-pushed the anyof-normalization-keep-read-write-only-attribute branch from 8e932d1 to 81243de Compare August 13, 2025 19:26
@Mattias-Sehlstedt Mattias-Sehlstedt marked this pull request as ready for review August 14, 2025 10:06
@wing328 wing328 merged commit 490de02 into OpenAPITools:master Aug 17, 2025
11 checks passed
@wing328 wing328 added Issue: Bug OpenAPI Normalizer Normalize the spec for easier processing labels Aug 17, 2025
@wing328 wing328 added this to the 7.15.0 milestone Aug 17, 2025
Goopher pushed a commit to Goopher/openapi-generator that referenced this pull request Sep 9, 2025
@robotmrv
Copy link
Copy Markdown

robotmrv commented Dec 4, 2025

@Mattias-Sehlstedt @wing328
what was the reason you did not use ModelUtils#copyMetadata() ?
I have an issue that e.g. I lose descrption from property level, and most like it is not only description but all except attributes copied in this PR

@Mattias-Sehlstedt Mattias-Sehlstedt deleted the anyof-normalization-keep-read-write-only-attribute branch December 4, 2025 16:48
@Mattias-Sehlstedt
Copy link
Copy Markdown
Contributor Author

Since there was no discussion regarding my speculation on whether it was relevant to do copyMetadata, I though it easiest to only adjust for the reported issue. This since I cannot myself state that I am certain that everything from copyMetadata is relevant and correct.

But if you have further issues with metadata propagation, I believe it would be best to raise an issue for that and exemplify what data that is "lost".

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

Labels

Issue: Bug OpenAPI Normalizer Normalize the spec for easier processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OpenAPINormalizer: anyOf simplification do not retains readOnly attribute

3 participants