https://github.com/unstoppablemango/openapi2go
Converts OpenAPI specifications to Go
https://github.com/unstoppablemango/openapi2go
ast codegen go openapi ux
Last synced: about 1 month ago
JSON representation
Converts OpenAPI specifications to Go
- Host: GitHub
- URL: https://github.com/unstoppablemango/openapi2go
- Owner: UnstoppableMango
- License: mit
- Created: 2025-08-17T18:36:21.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2026-05-15T19:18:57.000Z (about 1 month ago)
- Last Synced: 2026-05-15T19:59:19.698Z (about 1 month ago)
- Topics: ast, codegen, go, openapi, ux
- Language: Go
- Homepage:
- Size: 87.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openapi2go
A simple Go code generator for OpenAPI specifications.
## Usage
```text
Generate Go code from OpenAPI specifications
Usage:
openapi2go [flags]
Flags:
--config string Path to a configuration file
-h, --help help for openapi2go
--output string Path to the generated code output
--package-name string Name of the output package
--specification string Path to an OpenAPI specification file
```
### Configuration
Configuration can be provided with `--config` to customize the generated output.
Currently only a few options are supported.
```yaml
packageName: petstore # The Go package name to use. e.g. `package petstore`
types: # Override output by type, structure is defined by [config.go](./pkg/config/config.go)
Pet: # Selects the type matching the name defined in '.components.schemas.*'
fields: # Configuration for the fields on `Pet`
category: # Selects the field matching the name defined in '.components.schemas.Pet.properties.*'
type: any # Override the type specified by '.components.schemas.Pet.properties.category.type'
```
## Build
`make bin/openapi2go`
## Test
`make test`