data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

GraphQL schema fails to initialize when stored procedure parameter defaults use non-numeric strings Description:

Open JerryNixon opened this issue 2 months ago • 0 comments

When a stored procedure entity defines parameter defaults using non-numeric strings (for example "default": "number"), Data API builder fails to start with GraphQL enabled. The service throws a DataApiBuilderException during schema generation and /graphql becomes unavailable.

Image

Steps to Reproduce:

  1. Define a stored procedure entity like this:

    "GetSeriesActors": {
      "source": {
        "object": "dbo.GetSeriesActors",
        "type": "stored-procedure",
        "parameters": [
          { "name": "seriesId", "required": false, "default": "number" },
          { "name": "top", "required": false, "default": "number" }
        ]
      },
      "graphql": { "enabled": true, "operation": "mutation" }
    }
    
  2. Start DAB with GraphQL enabled.

  3. Observe logs.

Expected Behavior: DAB should either:

  • Treat "default": "number" as a literal string value, or
  • Reject invalid defaults during configuration validation with a clear error message before startup.

Actual Behavior: DAB starts but fails when GraphQL initializes. The logs show:

DataApiBuilderException: The parameter value number provided in configuration cannot be converted to the type Int
System.FormatException: The input string 'number' was not in a correct format.
   at System.Int32.Parse(String s)

After this error, /graphql is unavailable, though REST endpoints continue to function normally.

Environment:

  • Data API builder version: 1.7.75
  • Database: SQL Server
  • Host: Azure Container Apps
  • Authentication: StaticWebApps

Notes: The exception originates from GraphQLStoredProcedureBuilder.ConvertValueToGraphQLType when attempting to parse the invalid default value. DAB should validate or sanitize stored procedure parameter defaults before GraphQL schema generation to prevent this runtime failure.

JerryNixon avatar Nov 12 '25 04:11 JerryNixon