-
Notifications
You must be signed in to change notification settings - Fork 633
Swagger
The framework is designed based on swagger specification so it is our best interest to utilize the swagger.json to its full potential. Currently there are two components are using the swagger spec during runtime.
- Security - verify scope in the JWT token against scope defined in swagger spec if scope verificatio is true.
- Validator - validate request and response based on the definition in swagger spec for the uri and method.
As you have noticed, both components need to have swagger operation available based on the current request uri and method combination.
A specification file swagger.json should be in the config folder of your API implementation and it will be loaded to memory with SwaggerHelper during server start up. It will be cached in memory until the server is restarted.
In order to match the incoming request path to the paths defined in the swagger specification, all paths are normalized before matching action. SwaggerHelper provides an API to match the request path to the paths in swagger specification.
This is an HttpHandler to parse the swagger spec based on the request uri and method and attach an SwaggerOperation object to the exchange. The security and validator modules are using it to do their job without parsing the swagger second time.