-
Notifications
You must be signed in to change notification settings - Fork 226
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
add openapi 3.1 support #5372
Open
chrisradek
wants to merge
11
commits into
main
Choose a base branch
from
feature/openapi3.1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add openapi 3.1 support #5372
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
) This PR adds a new `@typespec/openapi3` emitter option to support specifying which Open API 3.x specs to output. Currently marked as `@internal` since currently only 1 version is actually supported. Once `v3.1` is supported we can remove the `@internal` annotation. --------- Co-authored-by: Christopher Radek <[email protected]>
Related to #5009 and #5010 This PR starts the work of getting an Open API 3.1 emitter in the `@typespec/openapi3` package. There are a few changes introduced in this PR: 1. Added the `OpenAPIDocument3_1` and related types. The biggest change here is updating the Open API schema to be based on Json Schema 2020-12. The Json Schema types don't currently exist in `@typespec/json-schema` so I added them to `@typespec/openapi3` for now while iterating. Can move to `@typespec/json-schema` now or later if we want. 2. Created the OpenAPISchemaEmitter3_1 class to target Open API 3.1 schemas. Currently completely standalone from Json Schema and Open API 3.0 schema emitters. 3. Updated nearly all tests to now run against both Open API 3.x versions. Intentionally left out the enum tests and schema examples since those will be updated shortly and be different between the two versions. 4. Added support for `type: "null"` in the 3.1 schema emitter. I squeezed this change in because the changes involved were actually really small, and this way TypeScript was happy we were emitting 3.1 schemas that matched the defined interface (no `nullable`). I copied the behavior that the Json Schema emitter uses for handling nulls. 5. Updated `exclusiveMinimum/Maximum` to be a number value instead of a boolean to match the Open API 3.1 spec. Note to reviewers: Hide whitespace - otherwise the test changes will look monstrous. --------- Co-authored-by: Christopher Radek <[email protected]>
Implements #5013 Co-authored-by: Christopher Radek <[email protected]>
Implements #5011 The only place I found this made sense to emit a schema type as a list currently is with enums as mentioned in the linked issue. Co-authored-by: Christopher Radek <[email protected]>
All changed packages have been documented.
Show changes
|
You can try these changes here
|
chrisradek
requested review from
bterlson,
markcowl,
allenjzhang and
timotheeguerin
as code owners
December 16, 2024 17:48
wanlwanl
approved these changes
Dec 24, 2024
This was referenced Dec 27, 2024
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for Open API 3.1 in the
@typespec/openapi3
package.The changes in this PR includes:
#4946
#5035
#5245
#5246