Fix 23034 - child constructor no longer has invalid access to parent field#23043
Open
hugin78 wants to merge 3 commits intoOpenAPITools:masterfrom
Open
Fix 23034 - child constructor no longer has invalid access to parent field#23043hugin78 wants to merge 3 commits intoOpenAPITools:masterfrom
hugin78 wants to merge 3 commits intoOpenAPITools:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/test/resources/bugs/issue_23034.yaml">
<violation number="1" location="modules/openapi-generator/src/test/resources/bugs/issue_23034.yaml:26">
P3: Discriminator `classType` is referenced but not defined in `Parent.properties` or `required`, making the OpenAPI schema invalid and likely generating models without the discriminator field.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #23034
Problem:
When using extensions with allOff and having a readonly field in the parent, then the generated child class, does not compile, as it access the private field in the parent class directly.
Solution:
This has been solved the same way as in the 'resteasy' library where the access type of the field in the parent is changed from 'private' to 'protected'.
Test:
A unittest has been added to verify the fix.
@bbdouglas @sreeshas@jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @martin-mfg
Summary by cubic
Fixes a compile error in the MicroProfile generator when a child model extends a parent with a readOnly field. Parent fields are now generated as protected so child classes compile correctly.
Written for commit eb40215. Summary will update on new commits.