OpenAPI 2 to OpenAPI 3
This command takes an OpenAPI 2 Description (also known as Swagger) and converts it into an OpenAPI 3 Description.
Usage
The oas2-to-oas3
command takes two parameters -input
and -output
-
--input
is the OpenAPI 2 document to transform (either as JSON or YAML) -
--output
is the OpenAPI 3 document to be created (either as JSON or YAML) -
--output
full path is created if it does not exist (likemkdir -p
) -
--allow-cycles
external cyclic JSONRefs are replaced with empty placeholders{}
You may omit the
--input
or--output
flags to read or write from stdin or stdout
Note
Under the hood, this command uses the kin-openapi Go library to do the conversion
Examples
Below are a few examples for using the oas2-to-oas3
command.
From files
Reading and writing to files explicitly
apigee-go-gen transform oas2-to-oas3 \
--input ./examples/specs/oas2/petstore.yaml \
--output ./out/specs/oas3/petstore.yaml
From stdin / stdout
Reading from stdin (from a file) and writing to stdout
From a process
Reading from stdin (piped from another process) and writing to stdout