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

openapi 3.1 - support tuples #5013

Open
chrisradek opened this issue Nov 7, 2024 · 0 comments
Open

openapi 3.1 - support tuples #5013

chrisradek opened this issue Nov 7, 2024 · 0 comments
Labels
emitter:openapi3 Issues for @typespec/openapi3 emitter

Comments

@chrisradek
Copy link
Member

Open API 3.1 supports defining tuples via Json Schema prefixItems.

Given the following TypeSpec:

model Foo {
  tuple: [string, string];
}

We can emit an Open API 3.1 schema that looks like this:

Foo:
  type: object
  properties:
    tuple:
      type: array
      prefixItems:
        - type: string
        - type: string
  required:
    - tuple

This matches what our json schema emitter currently emits.

For reference, our Open API 3.0 emitter does not support emitting tuples due to the lack of prefixItems and instead outputs this:

Foo:
  type: object
  required:
    - tuple
  properties:
    tuple:
      type: array
      items: {}
@chrisradek chrisradek added the emitter:openapi3 Issues for @typespec/openapi3 emitter label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:openapi3 Issues for @typespec/openapi3 emitter
Projects
None yet
Development

No branches or pull requests

1 participant