Azure / Azure/data-api-builder
[Enh]: For auto-config entities support `@db()`
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 370
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 9
Description
## What
Today, `autoentities.template` does not include newer metadata-driven properties, such as `description`.
This enhancement allows `autoentities.template` to use `@db()` so generated entities, fields, and parameters can pull values from SQL Server extended properties.
This enhancement depends on:
* #2949
* #2940
## Behavior
`@db()` expressions inside `autoentities.template` follow the parent `@db()` specification.
The only special behavior is timing: template-based `@db()` expressions are resolved after auto-entity expansion because template macros are not available until generation time.
## Supported template macros
`@db()` expressions may use existing auto-entity template macros:
```text
{schema}
{object}
{column}
{parameter}
{type}
```
## Template example
```json
{
"template": {
"description": "@db('{schema}.{object}:MS_Description', '{type}')",
"source": {
"parameters": {
"description": "@db('{schema}.{object}.@{parameter}:MS_Description', '{type}')"
}
},
"fields": {
"description": "@db('{schema}.{object}.{column}:MS_Description', '{type}')"
}
}
}
```
## Requirements
* Auto-entity expansion must complete before resolving template-based `@db()` expressions.
* Template macros must be replaced before `@db()` parsing.
* Unresolved macros inside an `@db()` expression fail validation.
* Contextual shorthand is not supported inside `autoentities.template`.
* The parent `@db()` spec remains authoritative for parsing, validation, resolution, and error behavior.
Contributor guide
Research direction
Start with autoentities.template and the parent @db() specification, including dependencies #2949 and #2940. Trace how auto-entity expansion, template macro replacement, and @db() resolution are ordered; done means supported macros resolve, unresolved macros fail validation, contextual shorthand remains unsupported, and parent parsing and error behavior are preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100