Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 13, 2025

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 autoentities section to the configuration schema and corresponding C# models for serialization/deserialization:

Schema Definition (schemas/dab.draft.schema.json):

  • Pattern matching: include, exclude (T-SQL LIKE syntax), name (interpolation: {schema}_{object})
  • Template configuration: mcp, rest, graphql, health, cache
  • Required permissions array with role-based actions

Object Models (src/Config/ObjectModel/):

  • AutoEntityPatterns - Pattern matching rules
  • AutoEntityTemplate - Template config with sub-records for each endpoint type
  • AutoEntity - Combines patterns, template, permissions
  • RuntimeAutoEntities - Collection class implementing IEnumerable<KeyValuePair<string, AutoEntity>>
  • RuntimeConfig.AutoEntities - Optional nullable property

Serialization (src/Config/Converters/):

  • RuntimeAutoEntitiesConverter - Custom JSON converter following RuntimeEntitiesConverter pattern

Example 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?

  • Unit Tests

New test CanLoadConfigWithAutoEntities validates:

  • Deserialization of multiple auto-entity definitions
  • Pattern properties (include/exclude/name)
  • Template settings across all endpoint types
  • Permissions array structure

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
    • Triggering command: /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
    • Triggering command: /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
    • Triggering command: /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
    • Triggering command: /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

This section details on the original issue you should resolve

<issue_title>Serialization/Deserialization of Wildcard properties</issue_title>
<issue_description>Need to create the new properties from Wildcard inside of the schema. The format is as following:

{
  "autoentities": {
    "{definition-name}": {

      "patterns": {
        "include": "%.%", // default: null. mssql syntax (T-SQL LIKE)
        "exclude": "sales.%", // default: null. mssql syntax (T-SQL LIKE)
        "name": "{schema}{object}" // default: null. interpolation syntax (must be unique)
      },

      "template": {
        "mcp": { "dml-tool": "<boolean>" }, // default: true
        "rest": { "enabled": "<boolean>" }, // default: true
        "graphql": { "enabled": "<boolean>" }, // default: true
        "health": { "enabled": "<boolean>" }, // default: true
        "cache": {
          "enabled": "<boolean>", // default: false
          "ttl-seconds": "<integer>", // default: null
          "level": "<enum>" // default: null
        }
      },

      "permissions": [ // at least one is required
        {
          "role": "<string>",
          "actions": [
            "*",
            "create",
            "read",
            "update",
            "delete"
          ]
        }
      ]
    }
  }
}

</issue_description>

<agent_instructions>Create the properties mentioned in the task inside of the schema file.</agent_instructions>

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits November 13, 2025 22:00
Co-authored-by: RubenCerna2079 <32799214+RubenCerna2079@users.noreply.github.com>
Co-authored-by: RubenCerna2079 <32799214+RubenCerna2079@users.noreply.github.com>
Co-authored-by: RubenCerna2079 <32799214+RubenCerna2079@users.noreply.github.com>
Copilot AI changed the title [WIP] Add serialization of wildcard properties in schema Add schema and serialization support for autoentities wildcard patterns Nov 13, 2025
Copilot AI requested a review from RubenCerna2079 November 13, 2025 22:16
Copilot finished work on behalf of RubenCerna2079 November 13, 2025 22:16
@RubenCerna2079 RubenCerna2079 added this to the Nov 2025 milestone Nov 13, 2025
@RubenCerna2079 RubenCerna2079 moved this from Todo to In Progress in Data API builder Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Serialization/Deserialization of Wildcard properties

2 participants