openapi/json-schema - `@extension` alignment - emit schemas
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.
est: 5
Moving to Post 1.0. Tentative sprint: July 25.
In addition, as off version 1.3.0, the import process will keep those double quotes, which leads to an invalid TypeSpec project.
So
x-foo:
name: The container file object
Leads to
@extension("x-oaiMeta", {"name":"The admin API key object"})
Which should be
@extension("x-oaiMeta", #{name:"The admin API key object"})
Or as a diff
-@extension("x-oaiMeta", {"name":"The admin API key object"})
+@extension("x-oaiMeta", #{name:"The admin API key object"})