Skip to content

Latest commit

 

History

History
46 lines (24 loc) · 2.88 KB

README.md

File metadata and controls

46 lines (24 loc) · 2.88 KB

OAS-file-and-Swagger-Tutorial

Prerequisite:

  1. Knowledge of REST API.
  2. Knowledge of OAS file and its components (info, host, basepath, produces, consumes, paths, method (post,get,delete,put), parameters, schemas, defintions, securitydefinitions, request body, response body, etc).

Swagger: https://swagger.io/

Create your account and use outstanding features of swagger.

Assignment based on:

  1. how to write OAS file using Swagger Editor
  2. generate interactive API documentation automatically using Swagger UI
  3. use OAS file to generate client/server side code automatically using Swagger CodeGen in different programming languages.

Swagger is tool to create and use REST API defintions. You write Open API Specification (OAS) file using swagger editor in which you define your REST API definitions (info, host, basepath, produces, consumes, paths, method (post,get,delete,put), parameters, schemas, defintions, securitydefinitions, etc). Then you use swagger tool for various purposes:

  1. Swagger UI - for automatically generate interactive api documentation (really awesome)

  2. Swagger CodeGen - for automatically generate client/server side code in different programming languages. (very cool features)

  3. Swagger Hub - to store and manage your OAS files and API definitions.

  4. Swagger Editor - to create OAS files (either in yaml or json).

This Tutorial contains two assignments to create OAS file using swagger editor and use swagger tool for various purposes.

  1. Music API Assignment: Follow exercises 2,3,4,5 and 6. It will give you good understanding of OAS file and Swagger. It contains "MusicAPI.yaml" file that is final OAS file after you follow all the exercises. It also have folder "Swagger-client-code-generated" which contain automatically generated client code in different programming languages (GO/JAVA/JAVASCRIPT).

For API Documentation, you can see it will generate on right side of your swagger editor.

You can see Swagger UI same as image attached below:

alt text

  1. Stripe Assignment: This contain assignment with step to step guide to make OAS file (with real REST API) and use swagger tool for various purposes as mentioned above. It also have folder "Swagger-client-code-generated" which contain automatically generated client code in different programming languages (GO/PYTHON) and "Swagger-server-code-generated" which contain automatically generated sever code in different programming languages (GO).

For API Documentation, you can see it will generate on right side of your swagger editor.

You can see Swagger UI same as image attached below:

alt text