Azure / Azure/data-api-builder

[Enh]: For auto-config entities support `@db()`

Open
#2,941 0 comments 1 reaction 0 assignees View on GitHub
2.x auto-config mcp-server
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.