Bug Report Checklist
Description
I had some code that used to work on 5.4.0 and now it doesn't. I traced the issue down to some change in the implementation of the usage of oneOf, where previously swagger::OneOf<A,B> was generated, now a new model is generated, but that new model is empty.
https://gist.github.com/mirosval/433308deb22727e3b1102fb58f3a6652
openapi-generator version
Works on 5.4.0 and does not since 6.0.
OpenAPI declaration file content or url
I'll provide a full gist, but shortly these are the interesting bits:
openapi: 3.0.3
...
components:
schemas:
Test:
type: object
properties:
something:
oneOf:
- type: string
- type: integer
Before:
pub something: Option<swagger::OneOf2<String,i32>>,
After:
pub something: Option<models::TestSomething>,
...
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
pub struct TestSomething {
}
Generation Details
generate-710:
docker run --rm \
-v $(PWD):/local openapitools/openapi-generator-cli:v7.1.0 generate \
-i /local/test.yaml \
--generator-name rust-server \
--output /local/openapi \
--global-property models,modelDocs=false,supportingFiles
mv openapi/src/models.rs test-710.rs
rm -rf openapi
Steps to reproduce
See the Gist and then make generate-540 generate-710 generate-latest
Related issues/PRs
This looks like it might be related:
#13538
Suggest a fix
It seems that generating intermediate models for nested properties is a good idea, just that there should probably be some heuristic to detect when the nested type is a oneOf and use a different path.
Bug Report Checklist
Description
I had some code that used to work on 5.4.0 and now it doesn't. I traced the issue down to some change in the implementation of the usage of
oneOf, where previouslyswagger::OneOf<A,B>was generated, now a new model is generated, but that new model is empty.https://gist.github.com/mirosval/433308deb22727e3b1102fb58f3a6652
openapi-generator version
Works on 5.4.0 and does not since 6.0.
OpenAPI declaration file content or url
I'll provide a full gist, but shortly these are the interesting bits:
Before:
After:
Generation Details
Steps to reproduce
See the Gist and then
make generate-540 generate-710 generate-latestRelated issues/PRs
This looks like it might be related:
#13538
Suggest a fix
It seems that generating intermediate models for nested properties is a good idea, just that there should probably be some heuristic to detect when the nested type is a
oneOfand use a different path.