Skip to content

Fix bug Autoentities doesn't account for schema #3468

Open
RubenCerna2079 wants to merge 4 commits intomainfrom
dev/rubencerna/fix-autoentity-missing-schema
Open

Fix bug Autoentities doesn't account for schema #3468
RubenCerna2079 wants to merge 4 commits intomainfrom
dev/rubencerna/fix-autoentity-missing-schema

Conversation

@RubenCerna2079
Copy link
Copy Markdown
Contributor

@RubenCerna2079 RubenCerna2079 commented Apr 24, 2026

Why make this change?

What is this change?

This changes how the in-memory entities are created from the autoentities property by specifying the schema as well as the object they come from in the MsSqlMetadataProvider, in order for DAB to not default to the dbo schema and cause a failure.

How was this tested?

  • Integration Tests
  • Unit Tests

Added tests that ensure entities that are in the non-default schema dbo are also created without any issues and can be used by the REST and GraphQL endpoints.

Sample Request(s)

"entities": {},
"autoentities": {
  "default": {
    "patterns": {
      "include": [ "foo.%", "bar.%" ],
      "name": "{schema}_{object}"
    },
    "template": {
      "mcp": { "dml-tools": true },
      "rest": { "enabled": true },
      "graphql": { "enabled": true },
      "health": { "enabled": true },
      "cache": {
        "enabled": false
      }
    },
    "permissions": [
      {
        "role": "anonymous",
        "actions": [
          "create",
          "read",
          "update",
          "delete"
        ]
      }
    ]
  }
image

@RubenCerna2079 RubenCerna2079 changed the title Fix bug Fix bug Autoentities doesn't account for schema Apr 24, 2026
@RubenCerna2079 RubenCerna2079 added this to the April 2026 milestone Apr 24, 2026
@RubenCerna2079 RubenCerna2079 linked an issue Apr 24, 2026 that may be closed by this pull request
1 task
@RubenCerna2079 RubenCerna2079 moved this from Todo to In Progress in Data API builder Apr 24, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes issue #3458 where autoentities generated without an explicit schema could later default to dbo during metadata lookup (causing startup failures for non-dbo objects) by ensuring MSSQL auto-generated entities preserve the originating schema in their source.object.

Changes:

  • Update MSSQL autoentity generation to set EntitySource.Object as {schema}.{object} instead of {object}.
  • Add MSSQL integration coverage to validate autoentity generation/usage for tables in non-default schemas (foo, bar) via REST + GraphQL.
  • Improve XML doc comments around autoentities-related tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Core/Services/MetadataProviders/MsSqlMetadataProvider.cs Ensures auto-generated entities retain schema qualification in source.object to avoid defaulting to dbo.
src/Service.Tests/Configuration/ConfigurationTests.cs Adds an integration test validating autoentities backed by non-dbo schemas work through REST/GraphQL; updates related doc comments.

Comment thread src/Service.Tests/Configuration/ConfigurationTests.cs
Comment thread src/Service.Tests/Configuration/ConfigurationTests.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

[Bug]: name of entities found in autoentities doesnt account for schema

4 participants