Skip to content

Instantly share code, notes, and snippets.

@islomar
Last active October 26, 2018 09:04
Show Gist options
  • Save islomar/6376610ccce347d5497cbcd806b4bdd9 to your computer and use it in GitHub Desktop.
Save islomar/6376610ccce347d5497cbcd806b4bdd9 to your computer and use it in GitHub Desktop.
Notes about Swagger

Swagger

  • https://swagger.io/
  • It belongs to SmartBear (SoapUI creators)
  • Swager 2.x = OpenAPI 3.x
  • Open Source tools
    • Swagger Editor
    • Swagger UI
    • Swagger Codegen
  • SwaggerHub:
    • https://swagger.io/tools/swaggerhub/pricing/
    • Free, Team and Enterprise plans
    • Free: you can not use the collaboration. It offers API Editor, hosted documentation and API mocking. Only public.
    • Team: 75$/month for 5 users, 150$/month for 10 users.
    • Enterprise: from 25 users up.

Swagger Editor

  • https://swagger.io/tools/swagger-editor/
  • For solo developers
  • Design, describe and document your API
  • Live Demo: https://editor.swagger.io/?_ga=2.219833689.11271560.1537128182-1999993717.1536953559
  • You can either download it or use Swagger Hub
  • Notes after trying it:
    • You can run it dockerized
    • You can import a YAML/JSon OAS spec
    • You can export a YAML/JSon OAS spec
    • You can generate a server from it (in many different languages/libraries)
    • You can generate a client from it (for many different languages/libraries)
      • It include some tests (without assertions).
    • Doubts/problems
      • Downloading the jaxrs and starting it, it doesn't work (maybe problems related with Spotify artifactory because of jett?).
      • Worked the spring server, then accessible through:
        • http://localhost:8080/v2
        • http://localhost:8080/v2/api-docs
        • curl -X GET --header 'Accept: application/json' 'http://localhost:8080/v2/store/inventory'
      • Java client:
        • The basePath is an optional parameter (it should be a mandatory parameter in the constructor, if the client forgets to change it, it would go against the Swagger Petstore).

Swagger UI

Swagger Inspector

Swagger codegen

Swagger Hub

  • https://swagger.io/tools/swaggerhub/
  • Swagger Hub Enterprise: https://swagger.io/tools/swaggerhub/enterprise/
  • API design and documentation with OpenAPI
  • API Mocking.
  • For teams. Free and Pro versions.
  • Definitions and documentation are hosted on SwaggerHub, the API design and documentation platform for teams.
  • Looks like you can create an organization (e.g. CSAT) and share access... (not sure)
    • You can share/invite to specific users (with an email).

More stuff

OpenAPI specification

To be read

Doubts

  • Test generation?
  • Lots of overlapping... ?
  • Prices for SwaggerHub Pro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment