Azure / Azure/data-api-builder

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

Open
#2,517 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
370
Avg merge
3d 17h
Merged PRs (30d)
8

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.