Skip to content

Support tenant-aware ORD for extensible multitenant CAP applications #389

@zongqichen

Description

@zongqichen

Problem

When a multitenant CAP application enables extensibility (cds.requires.extensibility) or feature toggles (cds.requires.toggles), tenants can customize their CDS model via cds push — adding entities, fields, and services. Per the ORD specification, these system-instance-aware differences MUST be reflected in the ORD document.

Currently, @cap-js/ord always generates ORD from the global base model, ignoring all tenant-specific model changes.

Affected tenant scenarios

Tenant action Expected ORD behavior Current
extend Orders with { x_field: String } OpenAPI/EDMX includes new field ❌ base model only
Add new entity x_SalesRegion New entityType in ORD
extend service with { entity x_Foo } New API resource in ORD
Feature toggle enables/disables a service Service appears/disappears in ORD

Note: for pure multitenancy without extensibility/toggles, the base ORD document is correctly shared across all tenants — no change needed.

Root cause

ORD endpoints bypass the CDS middleware stack (authctx-model), so tenant-specific CSN is never resolved. Other CDS plugins (e.g. @cap-js/graphql) correctly integrate with cds.middlewares, giving them automatic tenant awareness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions