Description
This issue tracks updating the @typespec/openapi
@extension
decorator to emit passed in Types as Open API schemas, similar to how @typespec/json-schema
will emit JSON Schemas for passed in types.
For example:
@OpenAPI.extension("x-foo", { foo: true })
model Foo {}
will generate a schema since { foo: true }
is a Type.
Foo:
type: object
x-foo:
type: object
required:
- foo
properties:
foo:
type: boolean
enum:
- true
This can be considered a breaking change for anyone passing in a model or tuple expression into @OpenAPI.extension
. To migrate, users will need to use Value kinds instead.
For example, { foo: true }
would be updated to #{ foo: true }
.
This should not be completed until after #6076 has been included in a release.