Skip to content

OAS Overlay

This command applies an OpenAPI Overlay 1.0 to an OpenAPI spec.

Usage

The oas-overlay command takes the following parameters:

  • --overlay is the path to the OpenAPI Overlay (either as JSON or YAML)

  • --spec (optional) is the path to the OpenAPI Spec to transform (either as JSON or YAML)

  • --output is the document to be created (either as JSON or YAML)

The --spec parameter is optional. If omitted, the OAS path is read form the extends property of the overlay. In this case, the path is relative to the location of the overlay file itself.

You may omit the --output flags to write to stdout
Full path is created if the --output does not exist (like mkdir -p)

Examples

Below are a few examples for using the oas-overlay command.

Write to file

Writing the output to a new file

apigee-go-gen transform oas-overlay \
  --spec ./examples/specs/oas3/petstore.yaml \
  --overlay ./examples/overlays/petstore.yaml \
  --output ./out/specs/oas3/petstore-overlaid.yaml 

Write To stdout

Writing the output to stdout

apigee-go-gen transform oas-overlay \
  --spec ./examples/specs/oas3/petstore.yaml \
  --overlay ./examples/overlays/petstore.yaml

Using the extends property

Instead of passing --spec, use the value of the extends property in the overlay

apigee-go-gen transform oas-overlay \
  --overlay ./examples/overlays/petstore.yaml