Polypheny-DB icon indicating copy to clipboard operation
Polypheny-DB copied to clipboard

Configured Swagger in the project

Open muaz-32 opened this issue 1 year ago • 0 comments

Summary

The Swagger plugin for Javalin is used to configure Swagger. However the annotated endpoints are shown in the Swagger UI but annotations are unable to access any user-defined class in the annotation, as a result, the request format is not shown properly.

Fixes: #478

Changes

The Javalin Openapi plugin is used to generate endpoints' documentation. However the plugin is for Javalin 5 or more, and their documentation suggests to use the javalin-rfc openapi plugin for versions below Javalin 5. ref: https://github.com/javalin/javalin-openapi/wiki/1.-Installation

For installation this documentation is followed: https://github.com/javalin/javalin-openapi/tree/99fe1f8eb1df46a1687653bf433d082d7115d426

But the javalin-rfc plugins are located at Reposilite repo. So the build.gradle file in the root is configured to search the Reposilite repo for plugins (ref: https://mvnrepository.com/artifact/io.javalin-rfc/openapi-annotation-processor/1.1.7).

And the OpenApi annotation is used in the request handler to generate docs. However, the annotation is unable to access any user-defiend class in the annotation. As a result, the request format is not generated properly. With further modifications this can be improved. Currently, only the '/createAdapter' endpoint's docs has been created to verify.

ToDo

  • [ ] Add the request format
  • [ ] Add the response format if possible
  • [ ] Add annotations for each endpoint
  • [ ] ...

muaz-32 avatar Apr 16 '24 10:04 muaz-32