lealceldeiro/org.wcdevs.blog.core

[Technical Request] Make tests clearer and document the code snippets explicitely.

Closed this issue · 1 comments

Contact Details

No response

What technical change you'd like to see implemented in our API?

Currently the API docs are generated using mockmvn restdocs and the request payloads and response fields are documented using snippet generated fields, like this:

.andDo(document("create_post_db_error", REQUEST_FIELDS, ERROR_RESPONSE_FIELDS));

When these snippets are referenced through variables (like REQUEST_FIELDS) it's hard to understand the test case documentation without navigating that variable declaration. The same happens with many of the payloads used to generated the test case; like this one:

It's great that there's a utility method that gives a dto stub (postDto), but when it comes to understand the test case (and more specifically when it depends on the specific fields) it's hard to follow the logic without navigating to the stub creation.

So, I'm proposing to explicitly use Strings with the actual values (even if that mean code duplication in the tests cases) in such cases.

Code of Conduct

  • I agree to follow this project's Code of Conduct

As an additional improvements (and since it's a very minor change) the anchor for endpoint to request posts with a specific status in the apidocs page is not working, a fix for this would be nice