Skip to content

[Bug]: when "request-body-strict": false OpenAPI returns "Entity_NoAutoPK" & "Entity_NoPK" #3260

@JerryNixon

Description

@JerryNixon

What?

When DAB is not strict it no longer requires NoAutoPk or NoPk types in OpenAPI.

  • This is misleading to tooling that doesn't realize these useless types are not required.
  • This also multiplies the size of the OpenAPI document, 2x for every entity.
Image

Configuration

{
  "$schema": "https://github.com/Azure/data-api-builder/releases/download/vmajor.minor.patch/dab.draft.schema.json",
  "data-source": {
    "database-type": "mssql",
    "connection-string": "@env('MSSQL_CONNECTION_STRING')",
    "options": {
      "set-session-context": false
    }
  },
  "runtime": {
    "telemetry": {
      "log-level": {
        "Default": "information"
      }
    },
    "rest": {
      "enabled": true,
      "path": "/api",
      "request-body-strict": false // set to false
    },
    "graphql": {
      "enabled": true,
      "path": "/graphql",
      "allow-introspection": true
    },
    "mcp": {
      "enabled": true,
      "path": "/mcp"
    },
    "host": {
      "cors": {
        "origins": [],
        "allow-credentials": false
      },
      "authentication": {
        "provider": "Unauthenticated"
      },
      "mode": "development"
    }
  },
  "autoentities": {
    "default": {
      "patterns": {
        "include": [
          "%.%%"
        ]
      },
      "permissions": [
        {
          "role": "anonymous",
          "actions": [
            {
              "action": "*"
            }
          ]
        }
      ]
    }
  },
  "entities": {}
}

OpenAPI

{
  "openapi": "3.0.1",
  "info": {
    "title": "Data API builder - REST Endpoint - anonymous",
    "version": "2.0.0"
  },

[snip]

  "components": {
    "schemas": {
      "Todo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "format": ""
          },
          "title": {
            "type": "string",
            "format": ""
          },
          "completed": {
            "type": "boolean",
            "format": ""
          }
        }
      },
      "Todo_NoAutoPK": { // should not exist
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "format": ""
          },
          "completed": {
            "type": "boolean",
            "format": ""
          }
        }
      },
      "Todo_NoPK": { // should not exist
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "format": ""
          },
          "completed": {
            "type": "boolean",
            "format": ""
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Todo"
    }
  ]
}

Metadata

Metadata

Assignees

Type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions