Repository README
This site documents the go-swagger/examples
repository — a collection of runnable, committed examples for
go-swagger, the spec-first code
generator for OpenAPI 2.0 (Swagger).
What’s here
Every example is a real Go project generated from an OpenAPI 2.0 spec: servers,
typed client SDKs, and CLIs. The generated code is committed and kept in sync
with go-swagger master by automated regeneration, so what you
read on this site matches what the current generator emits.
Browse the material two ways:
- Guides — reference recipes you dip into (servers, clients & CLI, authentication, streaming, customizing codegen).
- Tutorials — sequential, end-to-end walkthroughs that build something from scratch.
Where this fits — three sibling sites
go-swagger and go-openapi split their example material across three sites by workflow. This one is the spec-first corner: you write an OpenAPI spec and generate typed Go from it.
| Site | Workflow | You start from |
|---|---|---|
| this site | spec-first codegen | an OpenAPI 2.0 spec → generated server/client/CLI |
| go-openapi/runtime | untyped / hand-wired | the runtime API, no codegen |
| go-openapi/codescan | code-first | Go code → generated spec |
When a topic straddles two workflows, the page links across.
Getting started
You’ll need the swagger CLI on your PATH to regenerate or follow the
tutorials — see the installation instructions.
Then head to the todo-list tutorial to build a server
and client from one spec.
Status & releasing
The examples track go-swagger code generation for servers and clients. The
repository is deliberately left unreleased: it follows the generator on
go-swagger/go-swagger@master rather than tagging versions of its own.
Licensing
This software ships under the Apache-2.0 license.
Other documentation
- Contributing guidelines
- Regeneration — how the examples stay in sync
- All-time contributors