Skip to content

feat(@sap-ux/generator-odata-downloader): Adds recurisive hierarchy support#4518

Draft
IainSAP wants to merge 22 commits intomainfrom
feat/downloader/adds_rec_hierarchy
Draft

feat(@sap-ux/generator-odata-downloader): Adds recurisive hierarchy support#4518
IainSAP wants to merge 22 commits intomainfrom
feat/downloader/adds_rec_hierarchy

Conversation

@IainSAP
Copy link
Copy Markdown
Contributor

@IainSAP IainSAP commented Apr 3, 2026

Internal issue: 37596

feat(@sap-ux/generator-odata-downloader): recursive hierarchy support

Adds support for downloading Aggregation.RecursiveHierarchy OData V4 entity data and preparing it for use with the UI5 mock server.

Hierarchy detection & querying

  • getHierarchyEntities scans converted metadata for RecursiveHierarchy annotations and builds typed HierarchyEntity descriptors including qualifier, node property, parent property, draft status, and entity type keys
  • createQueryFromEntities issues a com.sap.vocabularies.Hierarchy.v1.TopLevels $apply query for hierarchy root entities instead of $top/$filter; draft-enabled hierarchies additionally wrap with ancestors() to scope to active entities
  • New buildNavPropHierarchyQuery constructs a nav-key-rooted TopLevels query (e.g. Orders('ORD1')/_Items?$apply=TopLevels(...)) for navigation properties that are themselves hierarchy roots
  • fetchData issues secondary nav-prop hierarchy queries and patches hierarchy properties (NodeId, DrillState, DistanceFromRoot, etc.) back onto the matching expanded records in-place

Data normalisation

  • normalizeHierarchyNodeIds converts ABAP RAW16 uppercase hex NodeId values to standard GUID format (8-4-4-4-12) for correct parent–child matching in the mock server
  • clearRootHierarchyParentProperty clears the parent pointer on root nodes (DistanceFromRoot === 0) so the mock server can identify hierarchy roots
  • createEntitySetData updated to apply both normalisation steps when hierarchy entities are present

Missing referential constraint handling

  • When a parent nav-prop has no ReferentialConstraint in metadata, getHierarchyEntities derives constraints from the entity's business keys using a property-name heuristic (e.g. PurchasingParentItem for PurchaseOrderItem)
  • The generator writing phase calls buildReferentialConstraintFileContent to emit a .js mock server file implementing getReferentialConstraints, written only when the entity set was downloaded and the file does not already exist

Prompt & UI changes

  • Hierarchy entities are hidden from the entity selection UI; their data is fetched automatically via dedicated TopLevels queries
  • Self-referential nav-props acting as ParentNavigationProperty are excluded from expand choices
  • IsActiveEntity semantic key is pre-populated with true for draft-enabled hierarchy roots
  • Generator wizard title added

Other improvements

  • Full backend URL construction now includes connectPath when resolving saved systems
  • Edm.Guid/Edm.UUID semantic key support added (unquoted in OData filter expressions)
  • getEntityModel returns an error string instead of undefined on failure
  • Key value validation clears values upfront and guards against undefined

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 3, 2026

🦋 Changeset detected

Latest commit: c2b45ef

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sap-ux/generator-odata-downloader Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@IainSAP IainSAP self-assigned this Apr 3, 2026
@IainSAP IainSAP changed the title Feat/downloader/adds rec hierarchy feat(@sap-ux/generator-odata-downloader): Adds recurisive hierarchy support Apr 3, 2026
@sonarqubecloud
Copy link
Copy Markdown

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