Azure / Azure/data-api-builder

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

オープン
#2,969 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
2.x
主要言語
C#
スター
1.5k
フォーク
370
平均マージ
3日 22時間
マージ済み PR(30日)
9

説明

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:

```json
"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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、GraphQL を有効にした stored-procedure の構成を再現し、報告された変換失敗が発生する GraphQLStoredProcedureBuilder.ConvertValueToGraphQLType を調査します。無効な文字列のデフォルト値によって GraphQL スキーマの初期化が妨げられなくなったことを、これらをリテラル値として扱うか、起動前に明確な構成エラーを生成することで確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, graphql, sql
領域
api, databases
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。