Azure / Azure/data-api-builder
[Bug]: GraphQL schema fails to initialize when stored procedure parameter defaults use non-numeric strings
- Lingua principale
- C#
- Stelle
- 1.5k
- Fork
- 370
- Merge medio
- 3g 22h
- PR unite (30g)
- 9
Descrizione
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.
**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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Iniziare riproducendo la configurazione della stored procedure con GraphQL abilitato e ispezionare GraphQLStoredProcedureBuilder.ConvertValueToGraphQLType, dove si verifica l’errore di conversione segnalato. Confermare che i valori predefiniti stringa non validi non impediscano più l’inizializzazione dello schema GraphQL, trattandoli come valori letterali oppure producendo un errore di configurazione chiaro prima dell’avvio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, graphql, sql
- Ambito
- api, databases
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100