Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: `autoentities` in a child configuration file (referenced via `data-source-files`) is not recognized — validation fails with "No entities found"

未关闭
#3,655 3 条评论 4 个 reaction 已指派 2 人 在 GitHub 查看

维护者通常 1 天内回复

@RubenCerna2079 已经在做这个了。

开始于 2026年6月12日。

  • #3723 来自 @copilot-swe-agent —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

auto-config bug cri
Description

When using multiple configuration files (one top-level file referencing others via data-source-files), autoentities defined in a child configuration file is not expanded during configuration validation. Validation fails with:

Config '<child-config>.json': No entities found. At least one entity must be defined or discovered from autoentities when a data source is configured.
fail: Config is invalid.

The same autoentities block works correctly when placed in the top-level configuration file. Only child files (referenced through data-source-files) are affected.

This appears to contradict the documented multi-file rules, which state that every configuration file may satisfy the entities requirement with either entities or autoentities:

Multiple configuration rules

  • Every configuration file must include the data-source property.
  • Every configuration file must include the entities property (or autoentities).

(See: Configuration schema reference — "Data source files" / "Multiple configuration rules".)

Version

Data API builder 2.0.8

Steps to reproduce
  1. Create a top-level config that references a child config and uses autoentities itself:
// dab-config.json (top-level)
{
  "$schema": "https://github.com/Azure/data-api-builder/releases/download/v2.0.8/dab.draft.schema.json",
  "data-source": { "database-type": "mssql", "connection-string": "@env('CONN_A')" },
  "data-source-files": [ "dab-config.child.json" ],
  "runtime": {
    "mcp": { "enabled": true },
    "host": { "mode": "production", "authentication": { "provider": "Unauthenticated" } }
  },
  "autoentities": {
    "def-a": {
      "patterns": { "name": "a_{object}", "include": [ "dbo.TableOne" ] },
      "permissions": [ { "role": "anonymous", "actions": [ { "action": "read" } ] } ]
    }
  }
}
  1. Create a child config that uses autoentities (no explicit entities):
// dab-config.child.json
{
  "$schema": "https://github.com/Azure/data-api-builder/releases/download/v2.0.8/dab.draft.schema.json",
  "data-source": { "database-type": "mssql", "connection-string": "@env('CONN_B')" },
  "autoentities": {
    "def-b": {
      "patterns": { "name": "b_{object}", "include": [ "dbo.TableTwo" ] },
      "permissions": [ { "role": "anonymous", "actions": [ { "action": "read" } ] } ]
    }
  }
}
  1. Run validation:
dab validate -c dab-config.json
Expected behavior

Validation passes. The child file's autoentities is expanded into entities (with the b_ prefix), exactly as documented and as it works in the top-level file.

Actual behavior

Validation fails:

The config satisfies the schema requirements.
fail: Config '<child-config>.json': No entities found. At least one entity must be defined or discovered from autoentities when a data source is configured.
fail: Config is invalid.

Notes:

  • Replacing the child's autoentities with explicit entities makes validation pass and the multi-database setup works correctly.
  • During an earlier (looser) run the child entities did appear in REST-path logging at runtime, yet schema validation still reported "No entities found" — suggesting the autoentities expansion is performed for the top-level config only and skipped for child configs at validation time.
Workaround

Define explicit entities in child configuration files instead of autoentities. Keep autoentities only in the top-level file.

Environment
  • Data API builder: 2.0.8
  • Database type: MSSQL (both data sources)
  • OS: Windows
  • Scenario: single DAB process serving two databases via data-source-files, MCP enabled (stdio)
主要语言
C#
星标
1.5k
派生
372
平均合并
9 天 1 小时
30 天内合并 PR
13

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Azure/data-api-builder 的其他 Issue

查看 Azure/data-api-builder 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。