Azure / Azure/data-api-builder

🥕[Bug]: JSON Schema: Redundant "required" Properties

Aperta
#2,517 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
1.5k
Fork
370
Merge medio
3g 22h
PR unite (30g)
9

Descrizione

The `jwt.audience` and `jwt.issuer` properties are not currently marked as required. However, for the `AzureAd` provider, these properties are essential for proper authentication configuration and should be required. For other providers, such as `StaticWebApps`, `AppService`, or `Simulator`, they are unnecessary and should not trigger schema validation errors.

## Suggestion

Update the schema to include conditional validation:

**Current Schema**

```json
"authentication": {
"type": "object",
"additionalProperties": false,
"properties": {
"provider": {
"type": "string",
"description": "The name of the authentication provider",
"default": "StaticWebApps"
},
"jwt": {
"type": "object",
"additionalProperties": false,
"properties": {
"audience": {
"type": "string"
},
"issuer": {
"type": "string"
}
}
}
}
}
```

**Updated Schema**

```json
"authentication": {
"type": "object",
"properties": {
"provider": {
"type": "string",
"enum": ["StaticWebApps", "AppService", "AzureAd", "Simulator"]
},
"jwt": {
"type": "object",
"properties": {
"audience": { "type": "string" },
"issuer": { "type": "string" }
}
}
},
"required": ["provider"],
"allOf": [
{
"if": {
"properties": { "provider": { "const": "AzureAd" } }
},
"then": {
"properties": {
"jwt": {
"required": ["audience", "issuer"]
}
}
}
}
]
}
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

L'issue non indica alcun file o test; individua prima lo schema di configurazione dell'autenticazione e i test che coprono la validazione dei provider. Verifica che AzureAd richieda sia jwt.audience sia jwt.issuer, mentre StaticWebApps, AppService e Simulator non li richiedono, quindi esegui i test di validazione pertinenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
azure, json
Ambito
api, authentication
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.