Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: JSON Schema: Redundant "required" Properties #2517

Open
JerryNixon opened this issue Jan 13, 2025 · 0 comments
Open

[Bug]: JSON Schema: Redundant "required" Properties #2517

JerryNixon opened this issue Jan 13, 2025 · 0 comments
Labels
bug Something isn't working triage issues to be triaged

Comments

@JerryNixon
Copy link
Contributor

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"]
          }
        }
      }
    }
  ]
}
@JerryNixon JerryNixon added bug Something isn't working triage issues to be triaged labels Jan 13, 2025
@JerryNixon JerryNixon changed the title [Bug]: Redundant "required" Properties [Bug]: JSON Schema: Redundant "required" Properties Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage issues to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant