Skip to content
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 improve conversion of OpenAPI3 component schemas into TypeSpec data types #4149

Merged

Conversation

chrisradek
Copy link
Member

@chrisradek chrisradek commented Aug 12, 2024

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. (tsp-openapi3 - allOf with more than one member not supported #4152)
  2. Place all component schemas under a Schemas namespace (and do something similar for Parameters) to prevent name collisions. (tsp-openapi3 - prevent collisions when same name is used in Open API 3 components categories. #4151)

@azure-sdk
Copy link
Collaborator

azure-sdk commented Aug 12, 2024

All changed packages have been documented.

  • @typespec/openapi3
Show changes

@typespec/openapi3 - fix ✏️

Updates tsp-openapi3 conversion of OpenAPI3 component schemas to improve handling of enums, unions, scalars, and aliases.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs

@chrisradek chrisradek added this pull request to the merge queue Aug 12, 2024
@chrisradek chrisradek added the openapi3:converter Issues for @typespec/openapi3 openapi to typespec converter label Aug 12, 2024
Merged via the queue into microsoft:main with commit eb4bada Aug 12, 2024
22 checks passed
@chrisradek chrisradek deleted the tsp-openapi3-improve-schemas-conversion branch August 12, 2024 23:03
sarangan12 pushed a commit to sarangan12/typespec that referenced this pull request 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openapi3:converter Issues for @typespec/openapi3 openapi to typespec converter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

openapi to tsp converter doesn't like unions
3 participants