Azure / Azure/data-api-builder
[Enh]: For auto-config entities support `@file()`
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 370
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 8
Description
## What
Allow `autoentities.template` to reference external metadata files using the new `@file()` syntax.
This enhancement allows auto-generated entities to inherit descriptions or other metadata from configuration-managed metadata files.
This enhancement depends on the following:
* #2794
* #2863
## New properties
This uses the new `@file()` syntax but behaves differently from normal configuration replacements. Because internal macros such as `{schema}`, `{object}`, `{column}`, and `{parameter}` are resolved dynamically within the auto-entity generation loop, these replacements cannot occur during configuration load. Instead, they must be evaluated **after** auto-generated entities have been expanded.
```json
{
"template": {
"description": "@file('{schema}.{object}.MS_Description')", // table-level
"source": {
"parameters": {
"description": "@file('{schema}.{object}.@{parameter}.MS_Description')" // parameter-level
}
},
"fields": {
"description": "@file('{schema}.{object}.{column}.MS_Description')" // column-level
}
}
}
```
In this case the metadata keys correspond to entries in the metadata files configured through `metadata-files`.
Example metadata file:
```json
{
"dbo.Author.MS_Description": "Author records in the system",
"dbo.Author.Id.MS_Description": "Primary key of the author",
"dbo.GetCustomer.@CustomerId.MS_Description": "Identifier of the requested customer"
}
```
During auto-entity generation, the template macros are expanded first and the resulting keys are resolved using `@file()` against the merged metadata dictionary.
Contributor guide
Assessment
This issue has not been assessed yet.