Skip to content

feat(pagination): total count, Link headers, exact sort/pagination against NGSI-L#163

Draft
Mortega5 wants to merge 7 commits into
mainfrom
feat/pagination-fields
Draft

feat(pagination): total count, Link headers, exact sort/pagination against NGSI-L#163
Mortega5 wants to merge 7 commits into
mainfrom
feat/pagination-fields

Conversation

@Mortega5

@Mortega5 Mortega5 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator
  • Add RFC 8288 Link headers (self/first/prev/next) and X-Forwarded-* aware URL building for paginated list responses.
  • Report X-Total-Count and return 206 Partial Content when a page doesn't cover the full result set, backed by the broker's NGSI-LD count query param.
  • Fix X-Total-Count/pagination on polymorphic listings (resourceSpecification, resource in resource-catalog/resource-inventory/software-management): these used to fan out one query per NGSI-LD sub-type and merge results client-side, which corrupted the count and offset/limit semantics. Now queried in a single broker call.
  • Default general.countHeader to NGSILD-Results-Count, the standard NGSI-LD header (Orion-LD still overrides it to Fiware-Total-Count per profile).
  • Translate the TMForum sort query param (sort=name,-billDate) into NGSI-LD's orderBy syntax (orderBy=name,billDate;desc).

Mortega5 added 7 commits July 3, 2026 11:08
Adds GeneralProperties.countHeader, auto-configured per broker profile
(NGSILD-Results-Count for Scorpio, Fiware-Total-Count for Orion-LD) across
all modules' application-{scorpio,orion-ld}.yaml. TmForumRepository.findEntities
now returns a PagedResult (items + offset/limit/totalCount) instead of a plain
list, so PaginationFilter can add X-Total-Count, compute next/last exactly
instead of the phase 1 heuristic, and return 206 Partial Content when the page
is genuinely partial - all degrading gracefully to phase 1 behavior when the
header isn't configured or the broker doesn't send it.
…r query

Resource, ResourceSpecification (resource-inventory, resource-catalog,
software-management) previously fanned out one query per NGSI-LD sub-type and
merged results client-side, which corrupted X-Total-Count and offset/limit
pagination since each fan-out call overwrote the shared request attributes.
Query all registered types in one broker call instead, mapping each returned
entity to its concrete domain class via findEntitiesPolymorphic/listPolymorphic.
@Mortega5
Mortega5 requested review from vramperez and wistefan July 8, 2026 09:58
@Mortega5 Mortega5 added the patch Should be applied for dependency updates and small bugfixes. label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

The following api specs are unavailable, please check if there are updates required.

Module Url
account https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF666_Account_Management_API_v4.0.0_swagger.json
agreement https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF651_Agreement_Management_API_v4.0.0_swagger.json
customer-bill-management https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF678_Customer_Bill_Management_API_v4.0.0_swagger.json
customer-management https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF629_Customer_Management_API_v4.0.0_swagger.json
party-catalog https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF632_Party_Management_API_v4.0.0_swagger.json
party-role https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF669_Party_Role_Management_API_v4.0.0_swagger.json
product-catalog https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.1.0/swagger/TMF620_Product_Catalog_Management_API_v4.1.0_swagger.json
product-inventory https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF637_Product_Inventory_Management_API_v4.0.0_swagger.json
product-ordering-management https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF622_Product_Ordering_Management_API_v4.0.0_swagger.json
resource-catalog https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.1.0/swagger/TMF634_Resource_Catalog_Management_API_v4.1.0_swagger.json
resource-function-activation https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF664_Resource_Function_Activation_Management_API_v4.0.0_swagger.json
resource-inventory https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF639_Resource_Inventory_Management_API_v4.0.0_swagger.json
service-catalog https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF633_Service_Catalog_Management_API_v4.0.0_swagger.json
usage-management https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF635_Usage_Management_API_v4.0.0_swagger.json

@Mortega5
Mortega5 marked this pull request as draft July 8, 2026 10:15
@Mortega5

Mortega5 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

depends on NGSI-LD PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Should be applied for dependency updates and small bugfixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant