
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@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 51,209 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 0 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.