Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Why make this change?

What is this change?

Modified RuntimeConfig constructor validation logic:

  • Defer validation: Check for data-source-files before requiring data-source or entities
  • Inherit from children: When parent has no data-source, use first child's data source as default
  • Final validation: Ensure at least one data source exists after loading all children

Parent config can now be:

{
  "$schema": "...",
  "data-source-files": ["dab-config-sql.json"],
  "runtime": {
    "rest": { "enabled": true },
    "graphql": { "enabled": true }
  }
}

How was this tested?

  • Integration Tests
  • Unit Tests

Added CanLoadMultiSourceConfigWithoutParentDataSource test validating:

  • Config loads successfully with only data-source-files (no parent data-source)
  • All child data sources are merged correctly
  • First child's data source becomes the default

Sample Request(s)

# Parent config with data-source-files only (no data-source)
dab start -c dab-config.json

Where dab-config.json contains only data-source-files pointing to child configs with actual data sources.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: Multiple Source Files Config not loading</issue_title>
<issue_description>### What happened?

As per documentation found here: https://learn.microsoft.com/en-us/azure/data-api-builder/concept/config/multi-data-source we have set up a overarching dab-config.json file with a file in the same directory dab-config-sql.json

The child file contains the appropriate data source and entities information. We have also included runtime information in the child file for troubleshooting purposes. The dab-config.json file contains the data source parameter and runtime information.

DAB seems to not be able to parse the data-source-files parameter and always errors with "data-source is a mandatory property in DAB config"

If running DAB Start -c dab-config-sql.json at the child file DAB start's with no issues proving the config is working appropriately.

Ultimately we want this to be deployed to an App Service however would like to confirm the viability of multiple config files for our use case locally.

Version

1.5.56

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

REST

Relevant log output

Information: Microsoft.DataApiBuilder 1.5.56
Information: Config not provided. Trying to get default config based on DAB_ENVIRONMENT...
Information: Environment variable DAB_ENVIRONMENT is (null)
Loading config file from C:\Users\User\DataApiBuilderAppProject\dab-config.json.
Deserialization of the configuration file failed during a post-processing step.
Message:
 data-source is a mandatory property in DAB Config
Stack Trace:
    at Azure.DataApiBuilder.Config.ObjectModel.RuntimeConfig..ctor(String Schema, DataSource DataSource, RuntimeEntities Entities, RuntimeOptions Runtime, DataSourceFiles DataSourceFiles) in /_/src/Config/ObjectModel/RuntimeConfig.cs:line 229
   at .ctor(Object[])
   at System.Text.Json.Serialization.Converters.LargeObjectWithParameterizedConstructorConverter`1.CreateObject(ReadStackFrame& frame)
   at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at Azure.DataApiBuilder.Config.RuntimeConfigLoader.TryParseConfig(String json, RuntimeConfig& config, ILogger logger, String connectionString, Boolean replaceEnvVar, EnvironmentVariableReplacementFailureMode replacementFailureMode) in /_/src/Config/RuntimeConfigLoader.cs:line 154
Error: Failed to parse the config file: dab-config.json.
Error: Failed to start the engine.

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

<agent_instructions>Resolve this with as little new code as possible</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@JerryNixon Could you provide your config files. You can exclude entities, and please XXX your connection information. Both files would help. @JerryNixon ### The Problem (I think)

The issue is that the data-source property validation happens BEFORE the data-source-files are processed. Here's the sequence of events in the RuntimeConfig constructor:

[JsonConstructor]
public RuntimeConfig(
    string? Schema,
    DataSource DataSource,
    RuntimeEntities Entities,
    RuntimeAutoentities? Autoentities = null,
    RuntimeOptions? Runtime = null,
    DataSourceFiles? DataSourceFiles = null,
    AzureKeyVaultOptions? AzureKeyVault = null)
{
    this.Schema = Schema ?? DEFAULT_CONFIG_SCHEMA_LINK;
    this.DataSource = DataSource;
    this.Runtime = Runtime;
    this.AzureKeyVault = AzureKeyVault;
    this.Entities = Entities;
    this.Autoentities = Autoentities;
    this.DefaultD...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes Azure/data-api-builder#2979

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Copilot AI and others added 2 commits February 2, 2026 23:13
Modified RuntimeConfig constructor to allow parent config files to omit
data-source and entities properties when data-source-files is provided.
The first child's data-source is used as the default when parent has none.

Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix loading issue with multiple source files configuration Fix: Allow parent config with data-source-files but no data-source Feb 2, 2026
Copilot AI requested a review from JerryNixon February 2, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants