Skip to content

Latest commit

 

History

History
59 lines (33 loc) · 3.55 KB

File metadata and controls

59 lines (33 loc) · 3.55 KB
graph LR
    Links["Links"]
    create_links["create_links"]
    Default_Link_Resolver["Default Link Resolver"]
    Limit_Offset_Link_Resolver["Limit-Offset Link Resolver"]
    Links -- "is instantiated by" --> create_links
    Default_Link_Resolver -- "utilizes" --> Links
    Limit_Offset_Link_Resolver -- "utilizes" --> Links
    create_links -- "instantiates and returns" --> Links
    Default_Link_Resolver -- "delegates final link object creation to" --> create_links
    Limit_Offset_Link_Resolver -- "delegates final link object creation to" --> create_links
Loading

CodeBoardingDemoContact

Details

The Pagination Link Generation subsystem is a crucial part of fastapi-pagination, focusing on creating HATEOAS-style navigation links to enhance API discoverability and client-side navigation. It embodies the "API Layer Extension" and "Strategy Pattern" architectural principles, providing a modular and extensible way to generate pagination links.

Links

A Pydantic data model that encapsulates the generated navigation links (e.g., "self", "first", "last", "next", "prev"). It serves as the primary integration point with FastAPI's response handling by adding these links to the response headers. Its internal methods manage the lifecycle of link generation and header injection.

Related Classes/Methods:

create_links

This is the fundamental function responsible for constructing the actual HATEOAS links. It takes raw link data (first, last, next, previous) and formats them into a Links object, handling URL resolution and path manipulation. It acts as a factory for Links instances.

Related Classes/Methods:

Default Link Resolver

Provides the default strategy for resolving and generating pagination links for common scenarios. It abstracts the specific logic required to determine the "first," "last," "next," and "previous" page parameters based on a generic pagination context.

Related Classes/Methods:

Limit-Offset Link Resolver

Offers a specialized strategy for resolving links specifically tailored to limit-offset based pagination. This component demonstrates the extensibility of the link generation mechanism by providing an alternative, concrete implementation of a pagination strategy.

Related Classes/Methods: