-
Notifications
You must be signed in to change notification settings - Fork 204
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
tsp-openapi3 - allOf with more than one member not supported #4152
Labels
bug
Something isn't working
openapi3:converter
Issues for @typespec/openapi3 openapi to typespec converter
triaged:core
Milestone
Comments
chrisradek
added
the
openapi3:converter
Issues for @typespec/openapi3 openapi to typespec converter
label
Aug 12, 2024
github-merge-queue bot
pushed a commit
that referenced
this issue
Aug 12, 2024
…peSpec data types (#4149) Fixes #4080 and #4088 This also fixes a few bugs/rough edges around generating TypeSpec types from OpenAPI3 component schemas. Still 2 things to follow up with that I'll create issues for: 1. Support `allOf` with more than 1 member. Likely this will result in spreading all the members, except extending 1 if there is 1 that has a discriminator. (#4152) 2. Place all component schemas under a `Schemas` namespace (and do something similar for `Parameters`) to prevent name collisions. (#4151) --------- Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
github-merge-queue bot
pushed a commit
that referenced
this issue
Aug 29, 2024
Fixes #4152 Depends on #4216 This PR updates how tsp-openapi3 handles generating models for schemas that use `allOf`. Currently `allOf` is ignored unless there is only 1 member and that member is a schema reference. In this scenario, the model extends the single member. This update now takes all of the schema `allOf` members into consideration when generating a model. - inline-schemas have their properties merged into the model's properties - schema references without a discriminator defined are spread into the model - if only 1 schema reference contains a discriminator, then the model extends it, otherwise these schema references are spread as well. --------- Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
weidongxu-microsoft
pushed a commit
to weidongxu-microsoft/typespec
that referenced
this issue
Sep 3, 2024
…soft#4232) Fixes microsoft#4152 Depends on microsoft#4216 This PR updates how tsp-openapi3 handles generating models for schemas that use `allOf`. Currently `allOf` is ignored unless there is only 1 member and that member is a schema reference. In this scenario, the model extends the single member. This update now takes all of the schema `allOf` members into consideration when generating a model. - inline-schemas have their properties merged into the model's properties - schema references without a discriminator defined are spread into the model - if only 1 schema reference contains a discriminator, then the model extends it, otherwise these schema references are spread as well. --------- Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
sarangan12
pushed a commit
to sarangan12/typespec
that referenced
this issue
Sep 16, 2024
…peSpec data types (microsoft#4149) Fixes microsoft#4080 and microsoft#4088 This also fixes a few bugs/rough edges around generating TypeSpec types from OpenAPI3 component schemas. Still 2 things to follow up with that I'll create issues for: 1. Support `allOf` with more than 1 member. Likely this will result in spreading all the members, except extending 1 if there is 1 that has a discriminator. (microsoft#4152) 2. Place all component schemas under a `Schemas` namespace (and do something similar for `Parameters`) to prevent name collisions. (microsoft#4151) --------- Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
sarangan12
pushed a commit
to sarangan12/typespec
that referenced
this issue
Sep 16, 2024
…soft#4232) Fixes microsoft#4152 Depends on microsoft#4216 This PR updates how tsp-openapi3 handles generating models for schemas that use `allOf`. Currently `allOf` is ignored unless there is only 1 member and that member is a schema reference. In this scenario, the model extends the single member. This update now takes all of the schema `allOf` members into consideration when generating a model. - inline-schemas have their properties merged into the model's properties - schema references without a discriminator defined are spread into the model - if only 1 schema reference contains a discriminator, then the model extends it, otherwise these schema references are spread as well. --------- Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
openapi3:converter
Issues for @typespec/openapi3 openapi to typespec converter
triaged:core
Describe the bug
Currently
tsp-openapi3
only includesallOf
members in a generated TypeSpec model if there is one referenced member. In this case, the generated model extends theallOf
member.Instead the default behavior should be that all
allOf
members are spread into the generated TypeSpec model.We may also need to support extending one of the
allOf
members if all of the following is true:Reproduction
currently generates
The
Cat
model is empty since more than 1allOf
is not supported. However, if the in-lined schema was moved from Cat'sallOf
to the schema's root:then the correct output is generated:
Checklist
The text was updated successfully, but these errors were encountered: