-
-
Notifications
You must be signed in to change notification settings - Fork 0
Introduction
- What is swagger-docs?
- What is swagger-docs for?
- What problems does swagger-docs solve?
- How does swagger-docs works internally?
In web apps, it is necessary to keep record and maintain API docs as it becomes easy for other developers and general public to view and test out APIs fast. But this cost developers and organisation their time and energy to create and maintain those APIs and as the web apps evolve and grow in size it is nightmare for any developer to precisely record every information of the APIs.
Well don't worry this is where Swagger-Docs will help you. This library aims to reduce efforts and time to document web APIs.
Swagger-Docs is designed to do the following:
- Fast API documentation
- Changes in APIs reflect immediately.
- Don't repeat yourself by writing code for route handler as well as writing api documentation.
- Customise API docs UI as you want.
Swagger-Docs is mainly useful for documenting apis built using plain node.js web apps, without any node.js framework. The problems that swagger-docs solves are:
- Removing need to write comments, including jsdoc comments to document apis ✅
- Removing need to update code comments for any change in apis ✅
- Fast documenting APIs as you create and modify it ✅
- Removing need to surf stack overflow for finding how and why of documenting APIs in Swagger ✅
- Added Typescript support for ease in using and understanding ✅
The internal structure is working based on Typescript decorators and Reflect Metadata APIs. The reflect metadata APIs helps to store metadata information about the object and when the app starts running with proper configuration, this library does following:
- Gather the reflect metadata around the objects
- Process it, perform validation and converts it in format compatible with Swagger UI config
- The processed reflect metadata helps to define routes in web app, so you can call the API.
- Then the processed metadata is set into Swagger UI config.
Next up is Getting Started and get familiar with the library
-
- SwaggerConfig
- SwaggerDocs
-
- Controller
- RouteMiddleware
-
-
- PathParam
- QueryParam
- Header
- Body
- Request
- Response
- Next
- File
-
- Get
- Put
- Post
- Delete
- Options
- Head
- Patch
- Trace
-
- RouteResponseBody
- RouteRequestBody
- RouteTag
- RouteSummary
- RouteDescription
- RouteExternalDocs
- RouteDeprecated
- RouteSecurity
- RouteServers
-
-
- IsArray
- IsBoolean
- IsNumber
- IsObject
- IsString
- IsEnum