Azure / Azure/data-api-builder
[Enh]: For auto-config entities support `@db()`
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 370
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 8
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
Assessment
This issue has not been assessed yet.