Fix: Allow parent config with data-source-files but no data-source #3098
+110
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why make this change?
data-source-filesincorrectly require adata-sourceproperty, even when child configs contain valid data sources. This breaks the multi-data-source configuration pattern documented at https://learn.microsoft.com/en-us/azure/data-api-builder/concept/config/multi-data-sourceWhat is this change?
Modified
RuntimeConfigconstructor validation logic:data-source-filesbefore requiringdata-sourceorentitiesdata-source, use first child's data source as defaultParent config can now be:
{ "$schema": "...", "data-source-files": ["dab-config-sql.json"], "runtime": { "rest": { "enabled": true }, "graphql": { "enabled": true } } }How was this tested?
Added
CanLoadMultiSourceConfigWithoutParentDataSourcetest validating:data-source-files(no parentdata-source)Sample Request(s)
# Parent config with data-source-files only (no data-source) dab start -c dab-config.jsonWhere
dab-config.jsoncontains onlydata-source-filespointing 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
Code of Conduct
<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-sourceproperty validation happens BEFORE thedata-source-filesare processed. Here's the sequence of events in theRuntimeConfigconstructor: