Description
Swagger documentation must be added to the API to provide clear and interactive documentation for all available endpoints. Since the API is developed using versioning, Swagger must support versioned documentation.
Requirements
- Integrate Swagger with the current Go API (net/http).
- Generate Swagger documentation from code annotations.
- Expose the Swagger UI endpoint.
- Support API versioning.
Swagger Structure
- The basic Swagger information (title, description, etc.) must be defined inside
main.
- Each API version will have its own documentation inside
cmd/api/server/v1.
- In the
New function of each version, version-specific annotations must be added, for example: // @BasePath /api/v1.
- The generated Swagger code must be located inside
cmd/api/server/v1/api-docs.
Notes
- If the implementation requires additional tooling or configuration changes, they should remain minimal and consistent with the current setup.
- Testing is not required for this issue.
- Questions or better solutions should be discussed in the issue comments.
Resource
https://medium.com/@fernandoamorindev/documenting-an-api-in-golang-with-net-http-and-swagger-a3fd58c6f96c
Description
Swagger documentation must be added to the API to provide clear and interactive documentation for all available endpoints. Since the API is developed using versioning, Swagger must support versioned documentation.
Requirements
Swagger Structure
main.cmd/api/server/v1.Newfunction of each version, version-specific annotations must be added, for example:// @BasePath /api/v1.cmd/api/server/v1/api-docs.Notes
Resource
https://medium.com/@fernandoamorindev/documenting-an-api-in-golang-with-net-http-and-swagger-a3fd58c6f96c