go-openapi runtime
github.com/go-openapi/runtime is a runtime library used to work with OpenAPI.
At this moment, it only supports OpenAPI v2 (aka Swagger).
It is used by clients and servers generated with go-swagger. or directly by applications that build untyped OpenAPI / Swagger clients or servers.
It ships:
- a configurable HTTP client transport (
client.Runtime) — TLS, proxy, timeouts, OpenTelemetry tracing, pluggable authentication - a server middleware pipeline that turns an analyzed OpenAPI spec into a
working
http.Handler— routing, security, parameter binding, validation and operation execution - a dependency-free server-middleware module with media-type processing, content
negotiation and doc-UI helpers, usable from any plain
net/httpserver
Status
Stable API. Actively maintained.
Getting started
Using only the dependency-free middleware (media types, negotiation, doc UIs):
Where to go next
- FeaturesFeatures supported by our client and server, with normative references. → usage/features
- Core
The five interfaces (
Consumer,Producer,Authenticator,Authorizer,OperationHandler) every other piece is built on, plus content-type and validation plumbing.→ usage/core
- Client
Configuring
client.Runtimefor TLS, auth, OpenTelemetry tracing and context-aware request submission.→ usage/client
- Server
The Router → Binder → Validator → Security → OperationExecutor → Responder pipeline that turns a spec into a handler.
→ usage/server
- Standalone
Use the media-type, content-negotiation and doc-UI helpers from any plain
net/httpserver, with no transitive OpenAPI dependencies.→ usage/standalone
Looking for runnable code? See examples.
Licensing
SPDX-FileCopyrightText: Copyright 2025 go-swagger maintainers
This library ships under the Apache-2.0 license.
Contributing
Issues and pull requests welcome.
See the shared go-openapi contributing guidelines and the per-repo notes in project/.
- Guides, references and examples for using github.com/go-openapi/runtime in clients, servers and standalone middleware.
- Educational deep-dives and FAQs covering both simple and advanced usage of the runtime. Start with the FAQ for quick answers; jump to a topic page for the full algorithm or behaviour reference.
- Repo-level information for github.com/go-openapi/runtime. Cross-org contributing and maintainer guides live in the shared go-openapi doc-site.