Skip to content

Swagger boilerplate with multi file support and REST best practices

Notifications You must be signed in to change notification settings

wit3k/swagger-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swagger api boilerplate

This is an example repository with easilly editable and browsable swagger api documentation based on a real life application for personal tasks management.

Installation and first steps

  1. Install needed dependencies:
  • npm
  • git
  1. Clone this repository and run:
./install.sh

Run

To run swagger-ui server, yaml server and open swagger-ui in browser simply run:

./run.sh
swagger validate http://localhost:8090

Features included

Directories structure

Remember that only directory which content should be edited is spec You can edit all yaml files and a given structure is only a proposition. Most important files are:

  • index.yaml your first step should be aditing this document
  • info.yaml your second step, let the world know who is responsible
  • tags.yaml the place to list all paths tags
  • paths.yaml list all paths here. Putting every path pattern into separate file is highly suggested
  • definitions.yaml list all definitions here. Putting every definition into separate file is highly suggested as well
  • Directories - every directory defines a separate module for the system. Modules contain:
    • paths
      • yaml files with paths for the module. Every path pattern should end up in a new file
    • definitions
      • All needed data structures for the module

Used conventions

Personal pro-tips

  • DO patch with document version info to avoid unexpected overwrites (TODO: after HATEOAS)
  • do NOT use tools like swagger-scala or other forms of inline API documentation tool - contract should be implementation agnostic and written BEFORE code not after

Todo

  • Authentication
  • API Testing
  • Nested modules
  • Hypermedia / HATEOAS
  • PATCH with version check
  • API Versioning
  • Get rid of own yaml-server and use swagger serve when it will be implemented in swagger-cli

About

Swagger boilerplate with multi file support and REST best practices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published