Skip to main content
Validate Image Category

Schema Structure

This category uses the standard QR code category structure.

Components Used

This category uses the following components:

Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "array",
  "title": "Image Category Schema",
  "description": "Validate Image Category",
  "items": {
    "type": "object",
    "required": [
      "type",
      "data"
    ],
    "properties": {
      "type": {
        "type": "string",
        "enum": [
          "design_info",
          "cover_page",
          "main_page"
        ]
      },
      "data": {
        "type": "object"
      }
    },
    "additionalProperties": false,
    "allOf": [
      {
        "if": {
          "properties": {
            "type": {
              "const": "design_info"
            }
          }
        },
        "then": {
          "properties": {
            "data": {
              "type": "object",
              "required": [
                "color",
                "fontFamily",
                "fontSize"
              ],
              "properties": {
                "color": {
                  "type": "object",
                  "required": [
                    "button",
                    "text"
                  ],
                  "properties": {
                    "button": {
                      "type": "string",
                      "pattern": "^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"
                    },
                    "text": {
                      "type": "string",
                      "pattern": "^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"
                    }
                  },
                  "additionalProperties": false
                },
                "fontFamily": {
                  "type": "string"
                },
                "fontSize": {
                  "type": "number"
                }
              },
              "additionalProperties": false
            }
          }
        }
      },
      {
        "if": {
          "properties": {
            "type": {
              "const": "cover_page"
            }
          }
        },
        "then": {
          "properties": {
            "data": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^(https?://.*\\.(png|jpg|jpeg|svg|gif|PNG|JPG|JPEG|SVG|GIF))$"
                },
                "coverTitle": {
                  "type": "string",
                  "maxLength": 100
                },
                "buttonText": {
                  "type": "string"
                },
                "tracking": {
                  "$ref": "components/event_tracking.json"
                }
              },
              "allOf": [
                {
                  "if": {
                    "required": [
                      "url"
                    ]
                  },
                  "then": {
                    "required": [
                      "buttonText"
                    ]
                  }
                }
              ]
            }
          }
        }
      },
      {
        "if": {
          "properties": {
            "type": {
              "const": "main_page"
            }
          }
        },
        "then": {
          "properties": {
            "data": {
              "type": "object",
              "required": [
                "pageLayout",
                "files"
              ],
              "properties": {
                "pageTitle": {
                  "type": "string",
                  "maxLength": 100
                },
                "subHeading": {
                  "type": "string",
                  "maxLength": 200
                },
                "pageLayout": {
                  "type": "string",
                  "enum": [
                    "list",
                    "grid"
                  ]
                },
                "files": {
                  "type": "array",
                  "maxItems": 50,
                  "items": {
                    "type": "object",
                    "required": [
                      "url"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "url": {
                        "type": "string",
                        "format": "uri",
                        "pattern": "^(https?://.*\\.(png|jpg|jpeg|svg|gif|PNG|JPG|JPEG|SVG|GIF))$"
                      },
                      "name": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string",
                        "maxLength": 30
                      },
                      "caption": {
                        "type": "string",
                        "maxLength": 60
                      },
                      "size": {
                        "type": "number"
                      },
                      "tracking": {
                        "$ref": "components/event_tracking.json"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    ]
  }
}