SwagDoc is a Delphi library to generate swagger.json file for Swagger Spec version 2.0. Create a public documentation REST API using Swagger 2.0 for Delphi Language. SwagDoc's only responsibility is to generate the swagger.json file. The swagger.json file is responsible for containing all the documentation for your REST API. This file must be attached to the Swagger UI (User Interface) files.
SwagDoc follows the specification 2.0 because it is more popular in the market and also because it is considered a more stable version to exist the longest. SwagDoc does not yet support the Swagger 3.0 version, but depending on the demand and contributions to the project it may evolve to support spec 3.0.
The main prerequisite for working with SwagDoc is to know the Swagger 2.0 specification that can be viewed in the link below.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
When creating a Swagger documentation for your REST API you can produce a page like the following example.
-
Swagger Editor: https://editor.swagger.io
-
The classic swagger sample: http://petstore.swagger.io
-
Tools and Integrations: https://swagger.io/tools/open-source/open-source-integrations
For you to produce a page containing a Swagger documentation you need the Swagger UI distribution files.
These files you can find in the github swagger-api / swagger-ui repository.
https://github.com/swagger-api/swagger-ui/tree/master/dist
First you need to download the swagger user interface files and generate the swagger.json file. You then need to change the index.html file to indicate the relative path of the location where the swagger.json file is located on your web server that is hosting the swagger user interface files.
See an example below.