Skip to content

Files

Latest commit

0ac4dee · Jan 30, 2021

History

History
This branch is 714 commits behind oapi-codegen/oapi-codegen:main.

petstore-expanded

OpenAPI Code Generation Example

This directory contains an example server using our code generator which implements the OpenAPI petstore-expanded example.

This is the structure:

  • api/: Contains the OpenAPI 3.0 specification
  • api/petstore/: The generated code for our pet store handlers
  • internal/: Pet store handler implementation and unit tests
  • cmd/: Runnable server implementing the OpenAPI 3 spec.

To generate the handler glue, run:

go run cmd/oapi-codegen/oapi-codegen.go --package petstore examples/oapi-codegen/api/petstore-expanded.yaml  > examples/oapi-codegen/api/petstore.gen.go