Swagger
Plumier provide facility to generate Open API 3.0 Specification commonly used by Swagger UI. The API specification directly generated from controllers metadata.
#
Enable The FacilityTo enable this facility you need to install the @plumier/swagger
and use the SwaggerFacility
on existing Plumier application like below:
Above is the minimum configuration required to generate the Open Api 3.0 Specification, some configuration may needed but optional.
Using above code Plumier automatically generate Open API 3.0 Specification using controllers metadata and create two endpoints:
/swagger.json
The Open API 3.0 Specification/swagger
The swagger UI (API explorer)
#
Swagger EndpointBy default the endpoint of the Swagger ui is /swagger
this endpoint is customisable by providing endpoint
on the SwaggerFacility
like below:
Above code will host the Swagger ui in /explorer
endpoint.
#
Project InfoSwagger facility provide default project info for OpenAPI 3.0 spec, you can override this by providing it in facility constructor