Add schema and serialization support for autoentities wildcard patterns #2973
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?
Closes #[issue number not provided]
Enables configuration-driven automatic entity generation through wildcard pattern matching against database objects. The schema now supports defining entity templates with include/exclude patterns and default permissions.
What is this change?
Added
autoentitiessection to the configuration schema and corresponding C# models for serialization/deserialization:Schema Definition (
schemas/dab.draft.schema.json):include,exclude(T-SQL LIKE syntax),name(interpolation:{schema}_{object})mcp,rest,graphql,health,cacheObject Models (
src/Config/ObjectModel/):AutoEntityPatterns- Pattern matching rulesAutoEntityTemplate- Template config with sub-records for each endpoint typeAutoEntity- Combines patterns, template, permissionsRuntimeAutoEntities- Collection class implementingIEnumerable<KeyValuePair<string, AutoEntity>>RuntimeConfig.AutoEntities- Optional nullable propertySerialization (
src/Config/Converters/):RuntimeAutoEntitiesConverter- Custom JSON converter followingRuntimeEntitiesConverterpatternExample configuration:
{ "autoentities": { "public-tables": { "patterns": { "include": "dbo.%", "exclude": "dbo.internal_%", "name": "{schema}_{object}" }, "template": { "rest": { "enabled": true }, "graphql": { "enabled": true } }, "permissions": [ { "role": "anonymous", "actions": ["read"] } ] } } }How was this tested?
New test
CanLoadConfigWithAutoEntitiesvalidates:Sample Request(s)
N/A - This change adds schema and serialization infrastructure. Actual pattern matching and entity generation logic is not included in this PR.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
azuread/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/Cli.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/Cli.Tests.deps.json /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/testhost.dll --port 41689 --endpoint 127.0.0.1:041689 --role client --parentprocessid 4807 --telemetryoptedin false(dns block)custom/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/Cli.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/Cli.Tests.deps.json /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/testhost.dll --port 41689 --endpoint 127.0.0.1:041689 --role client --parentprocessid 4807 --telemetryoptedin false(dns block)entraid/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/Cli.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/Cli.Tests.deps.json /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/testhost.dll --port 41689 --endpoint 127.0.0.1:041689 --role client --parentprocessid 4807 --telemetryoptedin false(dns block)xxxxx/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/Cli.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/Cli.Tests.deps.json /home/REDACTED/work/data-api-builder/data-api-builder/src/out/tests/net8.0/testhost.dll --port 41689 --endpoint 127.0.0.1:041689 --role client --parentprocessid 4807 --telemetryoptedin false(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.