Skip to content

feat(api): add /structure/{type} handlers for all DPM artefact types#71

Merged
andres-sole merged 4 commits into
masterfrom
feature/add-api-entry-points
May 27, 2026
Merged

feat(api): add /structure/{type} handlers for all DPM artefact types#71
andres-sole merged 4 commits into
masterfrom
feature/add-api-entry-points

Conversation

@antonio-olleros
Copy link
Copy Markdown
Contributor

Wires REST endpoints for the 11 remaining artefact types alongside the existing category and release handlers, following SDMX-style URL grammar (wildcards, ~/+/* release tokens, pagination, allstubs detail).

Notable shape decisions:

  • modules embed children=tables (full shape); tablegroups embed tables and child-group stubs, both release-versioned independently;
  • contexts use virtual versioning driven by downstream property/item code drift;
  • operations carry the full nested tree (versions → nodes → operand references → locations) inline;
  • properties version through ItemCategory rows in the property meta-category and surface enumeration via PropertyCategory.

Every endpoint batch-loads its dependents; per-endpoint query-budget tests prevent N+1 regressions. _get_all_releases now sorts NULLs LAST so null-dated releases (e.g. EBA's 26.0.10) don't break the virtual- versioning iteration in _version_at_release. STRUCTURE = "structure" removed from ArtefactType — it was never a real artefact.

Summary

Checklist

  • Code quality checks pass (ruff format, ruff check, mypy)
  • Tests pass (pytest) with 100% branch coverage (coverage report --fail-under=100)
  • Documentation updated (if applicable)

Impact / Risk

  • Breaking changes? (public API / CLI / REST endpoints / Django models)
  • Database schema or migration concerns?
  • Notes for release/changelog?

Notes

Wires REST endpoints for the 11 remaining artefact types alongside the
existing category and release handlers, following SDMX-style URL grammar
(wildcards, ~/+/* release tokens, pagination, allstubs detail).

Notable shape decisions:
- modules embed children=tables (full shape); tablegroups embed tables
  and child-group stubs, both release-versioned independently;
- contexts use virtual versioning driven by downstream property/item
  code drift;
- operations carry the full nested tree (versions → nodes → operand
  references → locations) inline;
- properties version through ItemCategory rows in the property
  meta-category and surface enumeration via PropertyCategory.

Every endpoint batch-loads its dependents; per-endpoint query-budget
tests prevent N+1 regressions. _get_all_releases now sorts NULLs LAST
so null-dated releases (e.g. EBA's 26.0.10) don't break the virtual-
versioning iteration in _version_at_release. STRUCTURE = "structure"
removed from ArtefactType — it was never a real artefact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@antonio-olleros antonio-olleros requested review from a team and andres-sole May 26, 2026 18:21
Comment thread tests/unit/server/test_structure_context.py Fixed
Comment thread tests/unit/server/test_structure_datatype.py Fixed
Comment thread tests/unit/server/test_structure_framework.py Fixed
Comment thread tests/unit/server/test_structure_module.py Fixed
Comment thread tests/unit/server/test_structure_operation.py Fixed
Comment thread tests/unit/server/test_structure_operator.py Fixed
Comment thread tests/unit/server/test_structure_organisation.py Fixed
Comment thread tests/unit/server/test_structure_property.py Fixed
Comment thread tests/unit/server/test_structure_table.py Fixed
Comment thread tests/unit/server/test_structure_tablegroup.py Fixed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds REST router wiring and tests for additional /api/v1/structure/{type} artefact endpoints, extending the structure API beyond the existing category/release handlers.

Changes:

  • Adds registered handlers for table, tablegroup, module, framework, property, variable, context, operator, operation, datatype, and organisation.
  • Adds references=children support and removes the non-artefact structure enum value.
  • Adds broad endpoint, detail, references, empty-result, versioning, and query-budget regression tests.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/dpmcore/server/routers/structure.py Registers new structure handlers and updates artefact/reference enums.
tests/unit/server/test_structure_table.py Covers table endpoint payloads, versions, variables, and references.
tests/unit/server/test_structure_tablegroup.py Covers tablegroup hierarchy and children expansion.
tests/unit/server/test_structure_module.py Covers module endpoint, table children, and query budget.
tests/unit/server/test_structure_framework.py Covers framework endpoint and module children filtering.
tests/unit/server/test_structure_property.py Covers property versions, enumerations, and references.
tests/unit/server/test_structure_variable.py Covers variable versions, enumeration, keys, and references.
tests/unit/server/test_structure_context.py Covers virtual context versioning and compositions.
tests/unit/server/test_structure_operator.py Covers unowned operator endpoint and arguments.
tests/unit/server/test_structure_operation.py Covers operation versions, nodes, references, and locations.
tests/unit/server/test_structure_datatype.py Covers datatype hierarchy and children expansion.
tests/unit/server/test_structure_organisation.py Covers organisation filtering and response shape.
tests/unit/server/test_structure_versioning_regression.py Adds release-ordering and per-version enumeration regressions.

@andres-sole andres-sole merged commit 9631960 into master May 27, 2026
19 checks passed
@andres-sole andres-sole deleted the feature/add-api-entry-points branch May 27, 2026 15:55
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.

3 participants