Azure / Azure/data-api-builder

🥕[Bug]: JSON Schema: Inaccurate Required/Not-Required constraints

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

Descrizione

Discrepancies exist between the official Data API Builder documentation and the JSON schema regarding the required status of certain properties. The documentation is correct and highlights where the schema needs to be adjusted.

## Required Properties NOT Required in Schema

1. **`data-source.options.database`** (for `cosmosdb_nosql`)
- **Docs:** Required when `database-type` is `cosmosdb_nosql`.
- **Schema:** Not marked as required.

2. **`data-source.options.schema`** (for `cosmosdb_nosql`)
- **Docs:** Required when `database-type` is `cosmosdb_nosql`.
- **Schema:** Not marked as required.

3. **`entities..source.key-fields`**
- **Docs:** Required **only** when `type` is `view`.
- **Schema:** Not conditionally marked as required.

4. **`entities..permissions`**
- **Docs:** Required for defining access controls for the entity.
- **Schema:** Not marked as required.

## Not-Required Properties REQUIRED in Schema

1. **`runtime.rest.enabled`**
- **Docs:** Optional; defaults to `true`.
- **Schema:** Marked as required.

2. **`runtime.graphql.enabled`**
- **Docs:** Optional; defaults to `true`.
- **Schema:** Marked as required.

## Suggested Fix

1. **For `cosmosdb_nosql` Configuration:**

```json
{
"if": {
"properties": { "database-type": { "const": "cosmosdb_nosql" } }
},
"then": {
"properties": {
"options": {
"required": ["database", "schema"]
}
}
}
}
```

2. **For Entity Definitions:**

```json
{
"patternProperties": {
"^[a-zA-Z0-9_-]+$": {
"properties": {
"source": {
"properties": {
"type": { "type": "string" },
"key-fields": { "type": "array" }
},
"required": ["type"],
"allOf": [
{
"if": {
"properties": { "type": { "const": "view" } }
},
"then": { "required": ["key-fields"] }
}
]
},
"permissions": { "type": "array" }
},
"required": ["source", "permissions"]
}
}
}
```

3. **For Runtime Configuration:**

```json
{
"properties": {
"runtime": {
"properties": {
"rest": {
"properties": {
"enabled": { "type": "boolean", "default": true }
}
},
"graphql": {
"properties": {
"enabled": { "type": "boolean", "default": true }
}
}
}
}
}
}
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

L’issue non indica alcun file di schema né alcun punto di ingresso per i test. Individua il JSON Schema utilizzato per la configurazione di Data API Builder, confronta le relative proprietà obbligatorie e i valori predefiniti con la documentazione ufficiale, quindi valida le regole condizionali per Cosmos DB, le entità view, le autorizzazioni e i flag di runtime.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.