
Security News
PyPI Expands Trusted Publishing to GitLab Self-Managed as Adoption Passes 25 Percent
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads
@typespec/openapi3
Advanced tools
TypeSpec library for emitting OpenAPI 3.0 and OpenAPI 3.1 from the TypeSpec REST protocol binding and converting OpenAPI3 to TypeSpec
TypeSpec library for emitting OpenAPI 3.0 and OpenAPI 3.1 from the TypeSpec REST protocol binding and converting OpenAPI3 to TypeSpec
npm install @typespec/openapi3
tsp compile . --emit=@typespec/openapi3
emit:
- "@typespec/openapi3"
The config can be extended with options as follows:
emit:
- "@typespec/openapi3"
options:
"@typespec/openapi3":
option: value
emitter-output-dirType: absolutePath
Defines the emitter output directory. Defaults to {output-dir}/@typespec/openapi3
See Configuring output directory for more info
file-typeType: "yaml" | "json"
If the content should be serialized as YAML or JSON. Default 'yaml', it not specified infer from the output-file extension
output-fileType: string
Name of the output file. Output file will interpolate the following values:
Default: {service-name-if-multiple}.{version}.openapi.yaml or .json if file-type is "json"
Example Single service no versioning
openapi.yamlExample Multiple services no versioning
openapi.Org1.Service1.yamlopenapi.Org1.Service2.yamlExample Single service with versioning
openapi.v1.yamlopenapi.v2.yamlExample Multiple service with versioning
openapi.Org1.Service1.v1.yamlopenapi.Org1.Service1.v2.yamlopenapi.Org1.Service2.v1.0.yamlopenapi.Org1.Service2.v1.1.yamlopenapi-versionsType: array
new-lineType: "crlf" | "lf"
Set the newline character for emitting files.
omit-unreachable-typesType: boolean
Omit unreachable types. By default all types declared under the service namespace will be included. With this flag on only types references in an operation will be emitted.
include-x-typespec-nameType: "inline-only" | "never"
If the generated openapi types should have the x-typespec-name extension set with the name of the TypeSpec type that created it.
This extension is meant for debugging and should not be depended on.
safeint-strategyType: "double-int" | "int64"
How to handle safeint type. Options are:
double-int: Will produce type: integer, format: double-intint64: Will produce type: integer, format: int64Default: int64
seal-object-schemasType: boolean
If true, then for models emitted as object schemas we default additionalProperties to false for
OpenAPI 3.0, and unevaluatedProperties to false for OpenAPI 3.1, if not explicitly specified elsewhere.
Default: false
experimental-parameter-examplesType: "data" | "serialized"
Determines how to emit examples on parameters. Note: This is an experimental feature and may change in future versions. See https://spec.openapis.org/oas/v3.0.4.html#style-examples for parameter example serialization rules See https://github.com/OAI/OpenAPI-Specification/discussions/4622 for discussion on handling parameter examples.
@oneOfSpecify that oneOf should be used instead of anyOf for that union.
@TypeSpec.OpenAPI.oneOf
Union | ModelProperty
None
@useRefSpecify an external reference that should be used inside of emitting this type.
@TypeSpec.OpenAPI.useRef(ref: valueof string)
Model | ModelProperty
| Name | Type | Description |
|---|---|---|
| ref | valueof string | External reference(e.g. "../../common.json#/components/schemas/Foo") |
FAQs
TypeSpec library for emitting OpenAPI 3.0 and OpenAPI 3.1 from the TypeSpec REST protocol binding and converting OpenAPI3 to TypeSpec
We found that @typespec/openapi3 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.