-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[BUG][Codegen] 'Required property not in properties' error when the second referenced model is a combined model #17863
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
Comments
Wondering if there has been any progress on this or if there is a recommended workaround |
same with this issue. |
bump |
We have the same issue. We consider rolling back to openapi generator version 7.2.0 to avoid the 20+ errors in the log during compilation. |
Same Problem here with Version 7.11 |
thanks for reporting the issue. One way to use Can you please confirm there's no change in the output when upgrading from v7.2.0 to newer versions? cc @martin-mfg (author of 64f2cad) |
TL;DR: It's more or less a false alarm and I will remove it. As pointed out in this thread, the error message was introduced in 64f2cad, via a PR opened by me. This change only added the printed message, the reported "problem" itself existed already before. And the reported "problem" is in fact not (always) a problem. At the specific point in the code, it can be totally fine that a property is not part of the On the other hand, in certain situations it might in fact be a problem. OpenAPI Generator for sure has shortcomings when processing allOf/anyOf/oneOf specs. E.g. generating Java code from modules/openapi-generator/src/test/resources/3_0/anyOfDiscriminator.yaml triggers the discussed error message - and also it results in code which doesn't compile and which misses some of the specified properties. But this can be addressed in separate PRs by other contributors. Lastly, the discussed error message was part of my PR only because I accidentally included changes by @dabdirb from his PR in my PR. So maybe @dabdirb has further insights about this error message? |
Bug Report Checklist
Description
From version
7.3.0
when referencing two models using theoneOf
keyword and:property1
andallOf
keywordwe get this unexpected error in the logs:
Although we get this error, the generator doesn't exit and generates the api code.
We also see this error in the logs, when building the project from master following these https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator instructions. Here is one of the logs:
openapi-generator version
version
7.3.0
OpenAPI declaration file content or url
Here is the minimal
yaml
file that produces the above errors:Generation Details
Steps to reproduce
To reproduce the errors, you can run:
where
test.yaml
contains the above script.The errors we get when generating the code are:
Related issues/PRs
No related PRs/issues found.
Suggest a fix
The above error log is introduced by this commit 64f2cad.
We noticed that we don't get the error if we use one of the following options:
oneOf
keywordallOf
keyword to extend a model (e.g. in the above example define the properties of theUser
model directly on theUserInfoEmail
model)--openapi-normalizer REF_AS_PARENT_IN_ALLOF=true
argument when generating the code.The text was updated successfully, but these errors were encountered: