Wikimedia

Integrate SwaggerUI with the service template

The service template makes use of Swagger specifications in order to automatically test the service during the test phase as well as ensure that the service checker script we have in production can be used to monitor it regularly.

Even though we use Swagger, the service template itself does not automatically expose the information contained in the specification in a nice self-documented way via swagger-ui library.

That can be accomplished with the SwaggerUI package to obtain a result similar to Wikipedia's REST API documentation. We need to integrate it in the service template.

The implementation should be pretty straightforward. A route needs to be defined that would statically serve the dist content of the swagger-ui lib, possibly making some amendments on it, just like we do for RESTBase, and example could be found in https://github.com/wikimedia/hyperswitch/blob/master/lib/swaggerUI.js . The JSON spec should also be statically exposed, and the swagger-ui lib should be configured to request the JSON spec.

Task tags

  • json
  • swagger
  • rest

Students who completed this task

Phantom42

Task type

  • code Code
close

2016