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

feat: Enable paging for search endpoints #30

Merged
merged 12 commits into from
Feb 23, 2024
Merged

feat: Enable paging for search endpoints #30

merged 12 commits into from
Feb 23, 2024

Conversation

eikek
Copy link
Member

@eikek eikek commented Feb 23, 2024

Accepts optional request parameters per_page and page and return paging information with response headers.

@eikek eikek marked this pull request as ready for review February 23, 2024 08:15

lazy val router: HttpApp[F] =
Router[F](
s"/$businessRoot" -> businessRoutes,
"/" -> operationsRoutes
"/search" -> (OpenApiRoute(businessEndpoints) <+> search.routes),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if it wouldn't be good to keep the /search segment somewhere so it can be shared between this class and the SearchRoutes (the definition of server for the OpenAPI spec).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I removed it because it wasn't used anywhere else - but I now saw the other occurrence in OpenApiRoute. Thanks, will bring it back!

val perPage =
queryParam[Int]("per_page")
.description("How many items to return for one page")
.validate(Validator.min(1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so we won't forget, maybe we could add max validator as we are working on this now.

Copy link
Contributor

@jachro jachro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@eikek eikek merged commit 59f5c1e into development Feb 23, 2024
2 checks passed
@eikek eikek deleted the search-paging branch February 23, 2024 10:00
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.

2 participants