microsoft / microsoft/typespec
openapi/json-schema - `@extension` alignment - emit schemas
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
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:
```tsp
@OpenAPI.extension("x-foo", { foo: true })
model Foo {}
```
will generate a schema since `{ foo: true }` is a Type.
```yaml
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.
Contributor guide
Assessment
This issue has not been assessed yet.