Azure / Azure/data-api-builder

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

Offen
#2,519 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C#
Sterne
1.5k
Forks
370
Ø Merge
3 T. 22 Std.
Gemergte PRs (30 T.)
9

Beschreibung

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 }
}
}
}
}
}
}
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Das Issue nennt weder eine Schema-Datei noch einen Test-Einstiegspunkt. Finde das für die Konfiguration von Data API Builder verwendete JSON Schema, vergleiche dessen erforderliche Eigenschaften und Standardwerte mit der offiziellen Dokumentation und validiere anschließend die bedingten Regeln für Cosmos DB, View-Entitäten, Berechtigungen und Laufzeit-Flags.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
json
Bereich
api
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.