Skip to content

Commit

Permalink
Allow presets blocks as hash
Browse files Browse the repository at this point in the history
  • Loading branch information
miazbikowski committed Nov 4, 2024
1 parent 18f28fc commit d86120a
Showing 1 changed file with 62 additions and 42 deletions.
104 changes: 62 additions & 42 deletions schemas/theme/section.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,48 +111,10 @@
"$ref": "./default_setting_values.json"
},
"blocks": {
"type": "array",
"description": "Default blocks configurations to ship with this preset.",
"markdownDescription": "Default blocks configurations to ship with this preset.\n\n---\n\n[Shopify reference](https://shopify.dev/docs/themes/architecture/sections/section-schema#presets)",
"items": {
"type": "object",
"required": ["type"],
"additionalProperties": false,
"properties": {
"static": {
"type": "boolean",
"description": "If the block is rendered statically or not"
},
"id": {
"type": "string"
},
"type": {
"type": "string",
"description": "The block type."
},
"settings": {
"$ref": "./default_setting_values.json"
},
"blocks": {
"$ref": "#/properties/presets/items/properties/blocks"
}
},
"allOf": [
{
"if": {
"properties": {
"static": {
"const": true
}
},
"required": ["static"]
},
"then": {
"required": ["id"]
}
}
]
}
"oneOf": [
{ "$ref": "#/definitions/blocks_array" },
{ "$ref": "#/definitions/blocks_hash" }
]
}
}
}
Expand Down Expand Up @@ -258,6 +220,64 @@
"uniqueItems": true
}
}
},
"blocks_array": {
"type": "array",
"description": "A list of child blocks that you might want to include.",
"markdownDescription": "A list of child blocks that you might want to include.\n\n---\n\n[Shopify reference](https://shopify.dev/docs/themes/architecture/blocks/theme-blocks/schema#presets)",
"required": ["type"],
"items": {
"type": "object",
"properties": {
"$ref": "#/definitions/base_block",
"id": {
"type": "string"
}
},
"allOf": [
{
"if": {
"properties": {
"static": {
"const": true
}
},
"required": ["static"]
},
"then": {
"required": ["id"]
}
}
]
}
},
"blocks_hash": {
"type": "object",
"description": "A list of child blocks that you might want to include.",
"markdownDescription": "A list of child blocks that you might want to include.\n\n---\n\n[Shopify reference](https://shopify.dev/docs/themes/architecture/blocks/theme-blocks/schema#presets)",
"additionalProperties": {
"$ref": "#/definitions/base_block"
}
},
"base_block": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"description": "The block type."
},
"settings": {
"$ref": "./default_setting_values.json"
},
"blocks": {
"$ref": "#/properties/presets/items/properties/blocks"
},
"static": {
"type": "boolean",
"description": "If the block is rendered statically or not"
}
}
}
}
}

0 comments on commit d86120a

Please sign in to comment.