Does JSON Validator support JSON Schema draft 7?

Topic summary

A developer is experiencing issues with JSON Schema validation for Shopify product metafields, specifically regarding conditional validation using if/then statements with allOf.

The Problem:

  • Created a metafield schema using conditional logic (draft 7 feature) to require different fields based on the associated_option_name value
  • When associated_option_name is “Modèles” and the price property is missing, the schema should require it and throw an error
  • However, Shopify’s validator accepts invalid data without throwing errors

Test Case:
The schema uses allOf with multiple if/then blocks to conditionally require fields like price, subtitle, or color depending on the option name. When testing with data where associated_option_name equals “Modèles” but price is absent, the product saves successfully instead of rejecting the invalid data.

Current Status:
The question remains unanswered - it’s unclear whether Shopify’s JSON validator fully supports JSON Schema draft 7 features, particularly conditional validation keywords.

Summarized with AI on November 23. AI used: claude-sonnet-4-5-20250929.

Hello folks,

I’ve created a metafield for a product, and have added the schema below:

{
  "title": "Metafield Information",
  "description": "This details how a metafield information is structured",
  "type": "object",
  "properties": {
    "option_values": {
      "type": "array",
      "description": "List of option values",
      "items": {
        "type": "object",
        "properties": {
          "associated_option_name": {
            "type": "string",
            "description": "The exact name of the option",
            "enum":[
              "Modèles", 
              "Installation", 
              "Modification",
              "Tailles",
              "Couleurs",
              "Modèle neuf",
              "Assurance",
              "SAV"
           ]
          },
          "title": {
            "type": "string",
            "description": "The option value title"
          },
          "subtitle": {
            "type": "string",
            "description": "The option value subtitle"
          },
          "price": {
            "type": "number",
            "description": "The option value price with decimals"
          },
          "color": {
            "type": "string",
            "description": "The option value color swab"
          }
        },
        "required": ["associated_option_name", "title"],
        "allOf": [
          {
            "if": {
              "properties": { "associated_option_name": { "const": "Modèles" } },
              "required": ["associated_option_name"]
            },
            "then": {
              "required": ["subtitle", "price"]
            }
          },
          {
            "if": {
              "properties": { "associated_option_name": { "const": "Installation" } },
              "required": ["associated_option_name"]
            },
            "then": {
              "required": ["price"]
            }
          },
          {
            "if": {
              "properties": { "associated_option_name": { "const": "Modification" } },
              "required": ["associated_option_name"]
            },
            "then": {
              "required": ["price"]
            }
          },
          {
            "if": {
              "properties": { "associated_option_name": { "const": "Tailles" } },
              "required": ["associated_option_name"]
            },
            "then": {
              "required": ["subtitle"]
            }
          },
          {
            "if": {
              "properties": { "associated_option_name": { "const": "Couleurs" } },
              "required": ["associated_option_name"]
            },
            "then": {
              "required": ["color"]
            }
          },
          {
            "if": {
              "properties": { "associated_option_name": { "const": "Modèle neuf" } },
              "required": ["associated_option_name"]
            },
            "then": {
              "required": ["price"]
            }
          },
          {
            "if": {
              "properties": { "associated_option_name": { "const": "Assurance" } },
              "required": ["associated_option_name"]
            },
            "then": {
              "required": ["price"]
            }
          },
          {
            "if": {
              "properties": { "associated_option_name": { "const": "SAV" } },
              "required": ["associated_option_name"]
            },
            "then": {
              "required": ["price"]
            }
          }
        ]
      }
    }
  },
  "required": ["option_values"]
}

{
  "option_values": [
    {
      "associated_option_name": "Modèles", 
      "title": "20 km d'autonomie",
      "subtitle": "Puissance de 350 W",
      "price": 0,
      "color": "black"
    }
  ]
}

When I use the following JSON in the product metafield, my product saves and DOES NOT throw back an error on the metafield.

{
  "option_values": [
    {
      "associated_option_name": "Modèles", 
      "title": "20 km d'autonomie",
      "subtitle": "Puissance de 350 W",
      "color": "black",
    }
  ]
}

Since “associated_option_name” is equal to “Modèles” and property “price” is non-existent, I had expected an error saying that price is required.

If I use the same code and test it on https://www.jsonschemavalidator.net/, I do get back the expected error. But if I change draft 7 to draft 4 (http://json-schema.org/draft-04/schema#), I no longer get an error, because the if/then statements are new additions.

Although I have specified the schema, is Shopify somehow overriding it with is own version of json-schema?
Is there a way for me to use draft 7? (or > draft 4)