Skip to content

tsp-openapi3 improve conversion of OpenAPI3 component schemas into TypeSpec data types#4149

Merged
chrisradek merged 6 commits into
microsoft:mainfrom
chrisradek:tsp-openapi3-improve-schemas-conversion
Aug 12, 2024
Merged

tsp-openapi3 improve conversion of OpenAPI3 component schemas into TypeSpec data types#4149
chrisradek merged 6 commits into
microsoft:mainfrom
chrisradek:tsp-openapi3-improve-schemas-conversion

Conversation

@chrisradek

@chrisradek chrisradek commented Aug 12, 2024

Copy link
Copy Markdown
Member

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

azure-sdk commented Aug 12, 2024

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs

Comment thread packages/openapi3/test/tsp-openapi3/test-host.ts Outdated
Comment thread packages/openapi3/test/tsp-openapi3/test-host.ts Outdated
Comment thread packages/openapi3/src/cli/actions/convert/generators/generate-types.ts Outdated
@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
@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