data-api-builder
data-api-builder copied to clipboard
🥕[Bug]: JSON Schema: Redundant "required" Properties
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
"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
"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"]
}
}
}
}
]
}