Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/carabasdaniel/go-swagger

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/carabasdaniel/go-swagger

  • v0.0.0-20160203065231-b072d08d38d9
  • Source
  • Go
  • Socket score

Version published
Created
Source

Swagger 2.0 Circle CI Build status Slack Status

license GoDoc GitHub version

Development of this toolkit is sponsored by VMware:
VMWare

There is a code coverage report available in the artifacts section of a build. Unfortunately using coveralls made the build unstable.

Contains an implementation of Swagger 2.0. It knows how to serialize and deserialize swagger specifications.

Swagger is a simple yet powerful representation of your RESTful API.
With the largest ecosystem of API tooling on the planet, thousands of developers are supporting Swagger in almost every modern programming language and deployment environment.

With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability. We created Swagger to help fulfill the promise of APIs.

Swagger helps companies like Apigee, Getty Images, Intuit, LivingSocial, McKesson, Microsoft, Morningstar, and PayPal build the best possible services with RESTful APIs. Now in version 2.0, Swagger is more enabling than ever. And it's 100% open source software.

Docs

https://goswagger.io

Install or update:

go get -u github.com/go-swagger/go-swagger/cmd/swagger

The implementation also provides a number of command line tools to help working with swagger.

Currently there is a spec validator tool:

swagger validate https://raw.githubusercontent.com/swagger-api/swagger-spec/master/examples/v2.0/json/petstore-expanded.json

To generate a server for a swagger spec document:

swagger generate server [-f ./swagger.json] -A [application-name [--principal [principal-name]]

To generate a client for a swagger spec document:

swagger generate client [-f ./swagger.json] -A [application-name [--principal [principal-name]]

To generate a swagger spec document for a go application:

swagger generate spec -o ./swagger.json

Licensing

The toolkit itself is licensed as Apache Software License 2.0. Just like swagger, this does not cover code generated by the toolkit. That code is entirely yours to license however you see fit.

What's inside?

For a V1 I want to have this feature set completed:

  • Documentation site
  • Play nice with golint, go vet etc.
  • An object model that serializes to swagger yaml or json
  • A tool to work with swagger:
    • validate a swagger spec document:
    • validate against jsonschema
    • validate extra rules outlined here
    • definition can't declare a property that's already defined by one of its ancestors (Error)
    • definition's ancestor can't be a descendant of the same model (Error)
    • each api path should be non-verbatim (account for path param names) unique per method (Error)
    • each security reference should contain only unique scopes (Warning)
    • each path parameter should correspond to a parameter placeholder and vice versa (Error)
    • path parameter declarations do not allow empty names (/path/{} is not valid) (Error)
    • each definition property listed in the required array must be defined in the properties of the model (Error)
    • each parameter should have a unique name and in combination (Error)
    • each operation should have at most 1 parameter of type body (Error)
    • each operation cannot have both a body parameter and a formData parameter (Error)
    • each operation must have an unique operationId (Error)
    • each reference must point to a valid object (Error)
    • each referencable definition must have references (Warning)
    • every default value that is specified must validate against the schema for that property (Error)
    • every example that is specified must validate against the schema for that property (Error)
    • items property is required for all schemas/definitions of type array (Error)
    • serve swagger UI for any swagger spec file
  • code generation
    • generate api based on swagger spec
    • generate go client from a swagger spec
  • spec generation
    • generate spec document based on the code
    • 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:
    • serve spec
    • routing
    • validation
    • additional validation through an interface
    • authorization
      • basic auth
      • api key auth
    • swagger docs UI
  • Typed JSON Schema implementation
    • JSON Pointer that knows about structs
    • JSON Reference that knows about structs
    • Passes current json schema test suite
  • extended string formats
    • uuid, uuid3, uuid4, uuid5
    • email
    • uri (absolute)
    • hostname
    • ipv4
    • ipv6
    • credit card
    • isbn, isbn10, isbn13
    • social security number
    • hexcolor
    • rgbcolor
    • date
    • date-time
    • duration
  • password
  • custom string formats

FAQs

Package last updated on 03 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc