Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #659: Means for Spring Hateoas Pagination #660

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

trohrberg
Copy link

To generate pagination automatically with spring hateoas, two vendor tags have been added and used within the template files api.mustache and pojo.mustache in JavaSpring.

The first boolean vendorTag (x-pagination) operates on the endpoint level in the OpenApi spec and causes the generation of a Pageable parameter which is provided by Spring Hateoas and contains the parameters for size, sort, and page. In order to work correctly with Spring Hateoas, the corresponding POJO class holding the response payload for the endpoint with pagination needs to be extended with a RepresentationModel also provided by Spring Hateoas.

The second boolean vendorTag (x-doc-only) operates on the parameter level for the specific endpoint in the OpenApi spec. This vendorTag is also needed in correspondence with pagination because as stated before parameters for size, sort, page are automatically generated for the endpoints with enabled pagination, i.e. one does not declare them in the spec. However, for many reasons (e.g. documentation with Swagger UI), it makes sense to still declare those parameters in the spec. The vendorTag x-doc-only set to true results in omitting those parameters in code generation.

To generate pagination automatically with spring hateoas, two vendor tags have been added and used within the template files api.mustache and pojo.mustache in JavaSpring.

The first boolean vendorTag (x-pagination) operates on the endpoint level in the OpenApi spec and causes the generation of a Pageable parameter which is provided by Spring Hateoas and contains the parameters for size, sort, and page. In order to work correctly with Spring Hateoas, the corresponding POJO class holding the response payload for the endpoint with pagination needs to be extended with a RepresentationModel also provided by Spring Hateoas.

The second boolean vendorTag (x-doc-only) operates on the parameter level for the specific endpoint in the OpenApi spec. This vendorTag is also needed in correspondence with pagination because as stated before parameters for size, sort, page are automatically generated for the endpoints with enabled pagination, i.e. one does not declare them in the spec. However, for many reasons (e.g. documentation with Swagger UI), it makes sense to still declare those parameters in the spec. The vendorTag x-doc-only set to true results in omitting those parameters in code generation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant