# go-swagger/go-swagger

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/go-swagger-go-swagger).**

9,989 stars · 1,306 forks · Go · Apache-2.0

## Links

- GitHub: https://github.com/go-swagger/go-swagger
- Homepage: https://goswagger.io
- awesome-repositories: https://awesome-repositories.com/repository/go-swagger-go-swagger.md

## Topics

`api` `code-generator` `go` `golang` `swagger-codegen` `swagger-spec` `swagger-specification`

## Description

go-swagger is a toolkit for working with Swagger/OpenAPI 2.0 specifications in Go. It generates server, client, and CLI code from a specification document, and can also produce a specification by scanning annotated Go source code. The project includes a static validation engine that checks documents against the schema and project-specific rules, and a specification transformation pipeline that resolves, flattens, and merges documents.

The toolkit generates both client and server code from the same specification, ensuring consistency in request and response handling. It also produces a command-line tool that maps each API operation to a subcommand, and hosts an interactive documentation server using Swagger UI or ReDoc. Code generation is customizable through user-supplied templates and vendor extensions.

Beyond code generation, the project validates specifications, compares documents for breaking changes, and merges multiple spec files into one. It can generate Markdown documentation and random test data from a specification. The toolkit is distributed as pre-compiled binaries for multiple platforms through GitHub releases and package managers.

## Tags

### Software Engineering & Architecture

- [Code from Specification Generators](https://awesome-repositories.com/f/software-engineering-architecture/openapi-specification-parsers/go-code-generators/specification-from-code-generators/code-from-specification-generators.md) — Generates Go server, client, and CLI code from Swagger/OpenAPI 2.0 specification documents.
- [Swagger Document Validators](https://awesome-repositories.com/f/software-engineering-architecture/api-documentation-validators/swagger-document-validators.md) — Checks a Swagger/OpenAPI 2.0 specification against the schema and additional rule sets for correctness. ([source](https://goswagger.io/go-swagger/features/))
- [Symmetric Code Generators](https://awesome-repositories.com/f/software-engineering-architecture/client-server-architecture/symmetric-code-generators.md) — Generates both client and server code from the same specification, ensuring request/response handling consistency.
- [Swagger Specification Validators](https://awesome-repositories.com/f/software-engineering-architecture/contextual-validation-rules/dynamic-validation-rules/validation-rule-engines/swagger-specification-validators.md) — Checks a Swagger 2.0 document against the specification and applies extra validation rules to catch common errors. ([source](https://goswagger.io/go-swagger/features))
- [OpenAPI Specification Generators](https://awesome-repositories.com/f/software-engineering-architecture/metadata-attachments/code-annotations/openapi-specification-generators.md) — Generates OpenAPI 2.0 specifications by scanning annotated Go source code at compile time.
- [Spec-from-Annotation Generators](https://awesome-repositories.com/f/software-engineering-architecture/metadata-attachments/code-annotations/spec-from-annotation-generators.md) — Scans Go source annotations to produce a complete Swagger specification document. ([source](https://goswagger.io/go-swagger/features))
- [Swagger](https://awesome-repositories.com/f/software-engineering-architecture/model-generators/swagger.md) — Generates Go struct definitions with validation from Swagger specification schemas. ([source](https://goswagger.io/go-swagger/faq/faq_model/))
- [Data Model Generators](https://awesome-repositories.com/f/software-engineering-architecture/openapi-specification-parsers/data-model-generators.md) — Creates Go struct definitions and validators for the schemas defined in a Swagger/OpenAPI 2.0 specification. ([source](https://goswagger.io/go-swagger/))
- [Go Code Generators](https://awesome-repositories.com/f/software-engineering-architecture/openapi-specification-parsers/go-code-generators.md) — Generates a fully typed Go client library from a Swagger specification. ([source](https://goswagger.io/go-swagger/features))
- [Specification from Code Generators](https://awesome-repositories.com/f/software-engineering-architecture/openapi-specification-parsers/go-code-generators/specification-from-code-generators.md) — Produces Swagger/OpenAPI 2.0 specifications by scanning annotated Go source code. ([source](https://goswagger.io/go-swagger/faq/faq_spec/))
- [Mock Server Generators](https://awesome-repositories.com/f/software-engineering-architecture/openapi-specification-parsers/mock-server-generators.md) — Generates fully functional Go HTTP servers with routing and validation from Swagger specifications. ([source](https://goswagger.io/go-swagger/features/))
- [CLI Command Generators](https://awesome-repositories.com/f/software-engineering-architecture/schema-driven-generators/cli-command-generators.md) — Produces a command-line tool that maps each API operation to a subcommand from a Swagger specification.
- [Specification Validation Schemas](https://awesome-repositories.com/f/software-engineering-architecture/specification-validation-schemas.md) — Validates Swagger/OpenAPI 2.0 documents against the specification schema and custom rule sets.
- [OpenAPI Specification Validators](https://awesome-repositories.com/f/software-engineering-architecture/specification-validation-schemas/openapi-specification-validators.md) — Validates Swagger/OpenAPI 2.0 documents against the schema and project-specific rules without runtime execution.
- [OpenAPI](https://awesome-repositories.com/f/software-engineering-architecture/architectural-design-patterns/state-management/change-detection/breaking-change-detectors/openapi.md) — Compares two Swagger/OpenAPI 2.0 specifications and fails a build if the newer version breaks backward compatibility. ([source](https://goswagger.io/go-swagger/))
- [API Specification Transformers](https://awesome-repositories.com/f/software-engineering-architecture/declarative-spec-compilers/api-specification-transformers.md) — Resolves references, flattens schemas, and merges multiple Swagger/OpenAPI 2.0 specification files.
- [API Specification Breaking Change Detectors](https://awesome-repositories.com/f/software-engineering-architecture/file-comparison-tools/comparison-reporting/specification-difference-reporting/api-specification-breaking-change-detectors.md) — Compares two Swagger/OpenAPI 2.0 specifications and reports breaking changes in backward compatibility.
- [JSON Schema Validation](https://awesome-repositories.com/f/software-engineering-architecture/json-schema-validation.md) — Validates JSON data against JSON Schema Draft 4 definitions with reference resolution. ([source](https://goswagger.io/go-swagger/features/))

### Part of an Awesome List

- [Document Q&A](https://awesome-repositories.com/f/awesome-lists/ai/document-q-a.md) — Generates fully functional Go HTTP servers from Swagger/OpenAPI 2.0 specifications. ([source](https://cdn.jsdelivr.net/gh/go-swagger/go-swagger@master/README.md))
- [Development Utilities](https://awesome-repositories.com/f/awesome-lists/devtools/development-utilities.md) — Implements Swagger 2.0 for Go applications.
- [Documentation Tools](https://awesome-repositories.com/f/awesome-lists/devtools/documentation-tools.md) — Full Swagger 2.0 implementation.
- [Frameworks and Libraries](https://awesome-repositories.com/f/awesome-lists/devtools/frameworks-and-libraries.md) — Tools for API documentation, generation, and validation.

### Data & Databases

- [Specification Merging](https://awesome-repositories.com/f/data-databases/data-modification-apis/incremental-syncing/incremental-data-merging/specification-merging.md) — Resolves references, flattens schemas, or merges multiple Swagger/OpenAPI 2.0 specifications into one. ([source](https://goswagger.io/))
- [Template-Based Code Customizers](https://awesome-repositories.com/f/data-databases/custom-data-types/custom-data-type-providers/code-generators/template-based-code-customizers.md) — Allows overriding default templates and injecting vendor extensions to customize generated code. ([source](https://cdn.jsdelivr.net/gh/go-swagger/go-swagger@master/README.md))
- [Breaking Change Detectors](https://awesome-repositories.com/f/data-databases/data-modification-apis/incremental-syncing/incremental-data-merging/specification-merging/breaking-change-detectors.md) — Compares two Swagger/OpenAPI 2.0 specifications and reports breaking changes in backward compatibility.
- [OpenAPI Specification Comparators](https://awesome-repositories.com/f/data-databases/value-comparators/epsilon-based-type-comparators/custom-data-comparators/openapi-specification-comparators.md) — Compares two Swagger specification documents and reports breaking changes in backwards compatibility. ([source](https://goswagger.io/go-swagger/))

### Development Tools & Productivity

- [OpenAPI Client SDK Generators](https://awesome-repositories.com/f/development-tools-productivity/openapi-client-sdk-generators.md) — Generates fully typed Go API client libraries from Swagger/OpenAPI 2.0 specifications. ([source](https://goswagger.io/go-swagger/))
- [Specification Transformers](https://awesome-repositories.com/f/development-tools-productivity/openapi-configurations/documentation-generators/openapi-specification-generators/mock-to-spec-conversion/specification-transformers.md) — Resolves, flattens, or merges Swagger/OpenAPI 2.0 specifications by inlining external references and reorganizing schemas. ([source](https://goswagger.io/go-swagger/))
- [Specification Consolidation](https://awesome-repositories.com/f/development-tools-productivity/openapi-configurations/documentation-generators/openapi-specification-generators/specification-consolidation.md) — Resolves, flattens, or merges Swagger specification documents to consolidate references and definitions. ([source](https://goswagger.io/go-swagger/))
- [OpenAPI Specification Linters](https://awesome-repositories.com/f/development-tools-productivity/openapi-specification-linters.md) — Checks a Swagger/OpenAPI 2.0 document against the schema and project-specific rules for correctness. ([source](https://goswagger.io/))
- [Spec-Driven Client Generators](https://awesome-repositories.com/f/development-tools-productivity/rest-api-clients/spec-driven-client-generators.md) — Generates a Go client from a Swagger/OpenAPI spec file, providing request and response handling for the described API. ([source](https://goswagger.io/go-swagger/faq/faq_client/))
- [Frontend API Mocking](https://awesome-repositories.com/f/development-tools-productivity/frontend-api-mocking.md) — Ships a built-in server that hosts a live, interactive UI for an API specification with mock data. ([source](https://goswagger.io/go-swagger/about/))
- [API Specification UI Rendering](https://awesome-repositories.com/f/development-tools-productivity/openapi-configurations/api-specification-ui-rendering.md) — Hosts an interactive Swagger UI documentation page for any given Swagger/OpenAPI 2.0 specification. ([source](https://goswagger.io/))
- [Template-Based Code Customizers](https://awesome-repositories.com/f/development-tools-productivity/project-scaffolding-config-code-generation/code-generation/workflow-to-code-generators/template-based-code-customizers.md) — Modifies generated code output through vendor extensions and user-supplied templates. ([source](https://cdn.jsdelivr.net/gh/go-swagger/go-swagger@master/README.md))
- [Template-Based Code Generators](https://awesome-repositories.com/f/development-tools-productivity/template-based-code-generators.md) — Allows users to override default code generation templates and inject vendor extensions for tailored output.

### DevOps & Infrastructure

- [API-to-CLI Generators](https://awesome-repositories.com/f/devops-infrastructure/cloud-infrastructure/cloud-computing-serverless/backend-as-a-service/authentication-as-a-service/api-to-cli-generators.md) — Generates a full CLI tool that maps each API operation to a subcommand. ([source](https://cdn.jsdelivr.net/gh/go-swagger/go-swagger@master/README.md))
- [Interactive API Documentation Servers](https://awesome-repositories.com/f/devops-infrastructure/devops/backend-as-a-service-platforms/backend-as-a-service-integrations/interactive-api-documentation-servers.md) — Hosts an interactive Swagger UI documentation page for any Swagger/OpenAPI 2.0 specification file. ([source](https://goswagger.io/go-swagger))

### Programming Languages & Runtimes

- [Specification from Code Generators](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-generators/specification-from-code-generators.md) — Produces Swagger/OpenAPI 2.0 specifications by scanning annotated Go source code. ([source](https://goswagger.io/))

### Security & Cryptography

- [API Authentication Schemes](https://awesome-repositories.com/f/security-cryptography/api-authentication-schemes.md) — Generates server and client code that supports Basic Auth, API key, and Bearer token authentication schemes. ([source](https://goswagger.io/go-swagger/features/))

### Testing & Quality Assurance

- [API Specification Compliance Tools](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/api-protocol-testing/api-specification-compliance-tools.md) — Checks a Swagger 2.0 document for structural correctness and compliance with the specification. ([source](https://slackin.goswagger.io/))

### User Interface & Experience

- [Specification from Code Generators](https://awesome-repositories.com/f/user-interface-experience/presentation-frameworks/code-presentation-utilities/code-line-highlighting/code-block-annotations/specification-from-code-generators.md) — Produces Swagger/OpenAPI 2.0 specifications by scanning annotated Go source code. ([source](https://goswagger.io/go-swagger/about/))

### Web Development

- [API Client Generators](https://awesome-repositories.com/f/web-development/api-client-generators.md) — Generates fully typed Go API client libraries from Swagger/OpenAPI 2.0 specifications. ([source](https://goswagger.io/go-swagger/generate/client/))
- [Specification Transformers](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas/openapi-specification-generators/specification-transformers.md) — Resolves references, flattens inline schemas, or merges multiple Swagger/OpenAPI 2.0 specifications into one. ([source](https://goswagger.io/go-swagger))
- [Specification Validators](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas/openapi-specification-generators/specification-validators.md) — Checks a Swagger/OpenAPI 2.0 specification against the schema and project-specific rules, reporting any violations. ([source](https://goswagger.io/go-swagger/))
- [API Documentation Hosting](https://awesome-repositories.com/f/web-development/api-documentation-hosting.md) — Serves interactive Swagger UI documentation pages for any Swagger/OpenAPI 2.0 specification.
- [Interactive API Documentation UIs](https://awesome-repositories.com/f/web-development/interactive-api-documentation-uis.md) — Hosts a live Swagger UI or ReDoc interface from a specification file for browsing and testing endpoints.
- [Annotated Response Models](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas/multi-response-modeling/annotated-response-models.md) — Annotates Go structs with swagger:response to specify the schema and content type of API responses. ([source](https://goswagger.io/go-swagger/faq/faq_spec/))
- [Struct-to-Parameter Mappings](https://awesome-repositories.com/f/web-development/struct-to-parameter-mappings.md) — Marks struct fields with swagger:params to define path, query, or header parameters for an API operation. ([source](https://goswagger.io/go-swagger/faq/faq_spec/))

### Content Management & Publishing

- [OpenAPI Specification Transformers](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/document-transformation-pipelines/openapi-specification-transformers.md) — Resolves, flattens, and merges Swagger/OpenAPI 2.0 documents through a multi-stage processing pipeline.
- [API Documentation Generators](https://awesome-repositories.com/f/content-management-publishing/markdown-documentation/api-documentation-generators.md) — Generates Markdown documentation describing endpoints and models from a Swagger specification. ([source](https://goswagger.io/))

### Networking & Communication

- [HTTP Client Configurations](https://awesome-repositories.com/f/networking-communication/api-integration-frameworks/http-client-libraries/http-client-configurations.md) — Sets custom headers, transports, and round trippers on the generated client to modify request handling. ([source](https://goswagger.io/go-swagger/faq/faq_client/))
