Features

Full features list #

  • An object model that serializes to swagger yaml or json (see the spec package)

  • A tool to work with swagger

    • Serve swagger UI for any swagger spec file

    • Validate a swagger spec document, with extra rules outlined here

    • Generate API components based on swagger spec

      • Flexible code generation, with customizable templates (package generator)
      • Generate go client from a swagger spec
      • Generate CLI (command line tool) client from a swagger spec
      • Support swagger polymorphism (discriminator with allOf composition)
    • Generate spec document based on annotated code (package scanner)

      • generate meta data (top level swagger properties) from package docs
      • generate definition entries for models
      • support composed structs out of several embeds
      • support allOf for composed structs
      • generate path entries for routes
      • generate responses from structs
      • support composed structs out of several embeds
      • generate parameters from structs
      • support composed structs out of several embeds
  • Middlewares (see: runtime package)

    • serve spec
    • routing
    • validation
    • additional validation through an interface
    • authorization, with auth composition (AND|OR authorization schemes)
      • basic auth
      • api key auth
      • oauth2 bearer auth
    • swagger docs UI (docUI and redoc flavors)
  • Typed JSON Schema implementation

    • JSON Pointer that knows about structs
    • JSON Reference that knows about structs
    • Supports most JSON schema features1
    • Validate JSON data against jsonschema (Draft 4), with full $ref support (see the validate package)
      • passes current json schema test suite
  • extended string and numeric formats (see: strfmt package)

    • JSON-schema draft 4 formats
      • date-time
      • email
      • hostname
      • ipv4
      • ipv6
      • uri
    • swagger 2.0 format extensions
      • binary
      • byte (e.g. base64 encoded string)
      • date (e.g. “1970-01-01”)
      • password
    • go-openapi custom format extensions
      • bsonobjectid (BSON objectID)
      • creditcard
      • duration (e.g. “3 weeks”, “1ms”)
      • hexcolor (e.g. “#FFFFFF”)
      • isbn, isbn10, isbn13
      • mac (e.g “01:02:03:04:05:06”)
      • rgbcolor (e.g. “rgb(100,100,100)”)
      • ssn
      • uuid, uuid3, uuid4, uuid5
  • Plays nice with golint, go vet etc.

1: currently adds extra support for additionalItems(not part of swagger), but not anyOf, oneOf and not.

Copyright 2015-2024 the go-swagger maintainers. This documentation is under an Apache 2.0 license.

Site built with HUGO using hugo-book