Week #2 Still Upgrading Guillotina_swagger :p

Published: 06/08/2019

Started to update Guillotina_swagger which is an addon to Guillotina, generates swagger UI for Guillotina, link to last week blog.

Things which were completed:- PR:- Upgrade swagger #3

  • Updated static js and css for OpenAPI 3. Issue#506
  • Updated swaggerObject(which is not OpenAPI object) according to OpenAPI 3 specifications. Issue#505

 What did you do this week?:- Issue#513 

Guillotina_swagger need authentication in order to generate the swagger object with the path object a user is authorized to access. Previously HTTP basic auth or JWT token were manually added to all the request headers and then the response object was rendered by swaggerUI which is now replaced by `securitySchemes` of OpenAPI 3. Instead of adding auth token to request header manually now `securitySchemes` of OpenAPI 3.

Definition of path objects is defined inline in the guillotina repository along with every endpoint. In OpenAPI 3  schema, parameters, responses, and definitions are now a part on a new object which is component, it's is one of the major changes required for the upgrade. 

What is coming up next?

Path Object is created by Guillotina_swagger according to the permissions a user have, previously it was done by sending auth token to the baseurl. Now all the authentication is taken care by swaggerUI auth except the request send to get the OpenAPI object, which requires a fix.

Did you get stuck anywhere?

 OpenAPI's authentication adds auth token to the request created to all the endpoints but the requests send to baseurl also need to have the auth token in order to generate the proper path object, it can be added manually to the request header but that would be a hacky solution. This problem still needs some research and brainstorming.