Description and expected behavior
When using QueryOptions slicing.includedModels / excludedModels, relational fields referencing excluded models are still exposed in both:
- The runtime API response
- The generated OpenAPI schema
Scenario
Given two models: Link and Workspace
I configure slicing to include Link but explicitly exclude Workspace:
const queryOptions: QueryOptions<SchemaType> = {
slicing: {
includedModels: ['Link', 'TargetingRule', 'Campaign', 'ClickEvent', 'Domain'],
excludedModels: ['Workspace'],
},
};
...
private readonly handler = new RPCApiHandler({ schema, queryOptions })
Observed behavior
- The
Link model still exposes:
workspaceId
workspace (relation)
- These fields:
- Appear in OpenAPI schema
- Are present in runtime responses
- Can even be explicitly populated via include
Expected behavior
When a model is excluded via slicing:
- All references to that model should be fully removed, including:
- Foreign keys (workspaceId)
- Relation fields (workspace)
- These fields should:
- Not appear in OpenAPI at all
- Not be queryable via include
Screenshots
1. IDE autocomplete for omit does not provide options to exclude relational fields like workspace or workspaceId
2. OpenAPI schema still includes workspace and workspaceId
3. Runtime API response includes workspaceId even when Workspace is excluded
4. Runtime API response includes workspace when configured via the include param
Environment (please complete the following information):
- ZenStack version: 3.6.3
- Database type: Postgresql
- Bun version: 1.3.12
- Package manager: Bun
Additional context
- This appears to affect both:
- OpenAPI generation
- Runtime query enforcement
- It is currently possible to bypass the exclusion by explicitly adding the relation to include
- The omit configuration does not surface relational fields, which makes it impossible to manually work around this
Description and expected behavior
When using QueryOptions
slicing.includedModels/excludedModels, relational fields referencing excluded models are still exposed in both:Scenario
Given two models: Link and Workspace
I configure slicing to include Link but explicitly exclude Workspace:
Observed behavior
Linkmodel still exposes:workspaceIdworkspace(relation)Expected behavior
When a model is excluded via slicing:
Screenshots
1. IDE autocomplete for omit does not provide options to exclude relational fields like
workspaceorworkspaceId2. OpenAPI schema still includes
workspaceandworkspaceId3. Runtime API response includes
workspaceIdeven when Workspace is excluded4. Runtime API response includes
workspacewhen configured via the include paramEnvironment (please complete the following information):
Additional context