I am trying to find the best way for my API documentation to be a source of truth and use it to verify the actual Java REST code ideally through integration testing or something similar. We use the first or contractual approach to the contract, therefore we do not want the documentation to be generated from annotated code necessarily and updated every time the developer makes changes.
One thought was to use Swagger, but I'm not sure how best to use it to test the API. Ideally, it would be good if the check was performed during the build or integration process to check if the real answer (and the request, if possible) is expected. I know that there are many uses and tools for Swagger, and I'm just trying to circle my head. Or, if there is a more efficient alternative to working with Java code.
source
share