Swagger to Notebook to Microservice
This sample project demonstrates how to use a Swagger specification to generate a Jupyter notebook. The generated notebook is then consumed by the Jupyter Kernel Gateway and is turned into a REST microservice.
Swagger Codegen Module
jupyter-swagger-codegen a java project for generating notebooks from a swagger specification can be found. For information, see the README in that directory.
Swagger Pet Store Implementation
There is a sample notebook, with supplemental files, in the
swagger-petstore-service folder. This notebook can be packaged and run in a docker container:
cd swagger-petstore-service # build the docker container ./package.sh # run the docker container ./run.sh
This service can be accessed from the swagger editor. To get the editor to correctly interact with the API:
- Copy the contents of
cat swagger-petstore-service/SwaggerPetstoreSpec.yaml | pbcopy
- Go to http://editor.swagger.io and paste the contents into the editor
- Modify the
hostproperty in the document to point to the
ip:portof your docker container