Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@typespec/openapi3
Advanced tools
TypeSpec library for emitting OpenAPI 3.0 from the TypeSpec REST protocol binding
This package provides the TypeSpec emitter to produce OpenAPI 3.0 output from TypeSpec source.
In your typespec project root
npm install @typespec/openapi3
tsp compile . --emit @typespec/openapi3
Add the following to the tspconfig.yaml
file.
emitters:
@typespec/openapi3: true
For configuration see options
import "@typespec/openapi3";
using OpenAPI;
// Using `using`
@useRef("common.json#/components/schemas/Foo")
model Foo {}
// Using fully qualified names
@OpenAPI.oneOf
union MyUnion {
cat: Cat,
dog: Dog,
}
Syntax:
@useRef(urlString)
@useRef
@useRef
is used to replace the TypeSpec model type in emitter output with a pre-existing named OpenAPI schema.
Syntax:
@oneOf()
@oneOf
emits oneOf
keyword for a union type in the resulting OpenAPI 3.0 specification. It indicates that the value of union type can only contain exactly one of the subschemas.
@oneOf
can only be applied to a union types.
Emitter options can be configured via the tspconfig.yaml
configuration:
emitters:
'@typespec/openapi3':
<optionName>: <value>
# For example
emitters:
'@typespec/openapi3':
outputFile: my-custom-openapi.json
or via the command line with
--option "@typespec/openapi3.<optionName>=<value>"
# For example
--option "@typespec/openapi3.output-file=my-custom-openapi.json"
output-file
Configure the name of the swagger output file relative to the compiler output-path
.
new-line
Set the newline character for emitting files. Can be either:
lf
(Default)crlf
omit-unreachable-types
Only include types referenced via an operation.
FAQs
TypeSpec library for emitting OpenAPI 3.0 from the TypeSpec REST protocol binding and converting OpenAPI3 to TypeSpec
The npm package @typespec/openapi3 receives a total of 67,405 weekly downloads. As such, @typespec/openapi3 popularity was classified as popular.
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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.