{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/snapvisor-io/json-schema/snapvisor-io-screenshot-input-schema.json",
  "title": "ScreenshotInput",
  "description": "Screenshot input",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/snapvisor-io-openapi.yml#/components/schemas/ScreenshotInput",
  "type": "object",
  "properties": {
    "key": {
      "type": "string",
      "pattern": "^[A-Fa-f0-9]{64}$"
    },
    "name": {
      "type": "string"
    },
    "baseName": {
      "description": "Name(s) to compare this screenshot against, instead of its own name. An array is tried in order: the first name that exists in the baseline wins, which lets a new screenshot fall back to an existing one.",
      "anyOf": [
        {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "parentName": {
      "type": [
        "string",
        "null"
      ]
    },
    "metadata": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "$schema": {
              "description": "Ignored. Can be set to get completions, validations and documentation in some editors.",
              "type": "string"
            },
            "url": {
              "description": "The URL of the page that was screenshotted",
              "type": [
                "string",
                "null"
              ]
            },
            "previewUrl": {
              "description": "An URL to an accessible preview of the screenshot",
              "type": [
                "string",
                "null"
              ]
            },
            "viewport": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "width": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "The width of the viewport"
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "The height of the viewport"
                    }
                  },
                  "required": [
                    "width",
                    "height"
                  ],
                  "description": "The viewport dimensions when the screenshot was taken"
                },
                {
                  "type": "null"
                }
              ]
            },
            "colorScheme": {
              "description": "The color scheme when the screenshot was taken",
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "light",
                    "dark"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "mediaType": {
              "description": "The media type when the screenshot was taken",
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "screen",
                    "print"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "test": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "description": "The unique identifier of the test",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "title": {
                      "type": "string",
                      "description": "The title of the test"
                    },
                    "titlePath": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The path of titles leading to the test"
                    },
                    "retries": {
                      "description": "The number of retries for the test",
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "retry": {
                      "description": "The current retry count",
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "repeat": {
                      "description": "The repeat count for the test",
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "location": {
                      "description": "The location of the test in the source code",
                      "type": "object",
                      "properties": {
                        "file": {
                          "type": "string",
                          "description": "The located file"
                        },
                        "line": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "The line number in the file"
                        },
                        "column": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "The column number in the file"
                        }
                      },
                      "required": [
                        "file",
                        "line",
                        "column"
                      ]
                    },
                    "annotations": {
                      "description": "Annotations associated to the test",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "The type of annotation"
                          },
                          "description": {
                            "description": "The description of the annotation",
                            "type": "string"
                          },
                          "location": {
                            "description": "The location of the annotation in the source code",
                            "type": "object",
                            "properties": {
                              "file": {
                                "type": "string",
                                "description": "The located file"
                              },
                              "line": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991,
                                "description": "The line number in the file"
                              },
                              "column": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991,
                                "description": "The column number in the file"
                              }
                            },
                            "required": [
                              "file",
                              "line",
                              "column"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "description": "A test annotation"
                      }
                    },
                    "tags": {
                      "description": "Tags associated to the test",
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "title",
                    "titlePath"
                  ],
                  "description": "The test that generated the screenshot"
                },
                {
                  "type": "null"
                }
              ]
            },
            "browser": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "The name of the browser"
                    },
                    "version": {
                      "type": "string",
                      "description": "The version of the browser"
                    }
                  },
                  "required": [
                    "name",
                    "version"
                  ],
                  "description": "The browser that generated the screenshot"
                },
                {
                  "type": "null"
                }
              ]
            },
            "automationLibrary": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "The name of the automation library"
                },
                "version": {
                  "type": "string",
                  "description": "The version of the automation library"
                }
              },
              "required": [
                "name",
                "version"
              ],
              "description": "The automation library that generated the screenshot"
            },
            "sdk": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "The name of the SDK"
                },
                "version": {
                  "type": "string",
                  "description": "The version of the SDK"
                }
              },
              "required": [
                "name",
                "version"
              ],
              "description": "The SDK that generated the screenshot"
            },
            "story": {
              "description": "Storybook story metadata",
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Unique ID of the story"
                    },
                    "tags": {
                      "description": "Tags attached to the story",
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mode": {
                      "description": "Story mode",
                      "type": "string"
                    },
                    "play": {
                      "description": "True if the story has a play function",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "description": "Storybook story metadata"
                },
                {
                  "type": "null"
                }
              ]
            },
            "capture": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "index": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "The 0-based position of the screenshot within its test, following capture order"
                    }
                  },
                  "required": [
                    "index"
                  ],
                  "description": "How the screenshot was captured within its test"
                },
                {
                  "type": "null"
                }
              ]
            },
            "tags": {
              "description": "Tags associated to the screenshot",
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "automationLibrary",
            "sdk"
          ],
          "description": "Metadata about a screenshot"
        },
        {
          "type": "null"
        }
      ]
    },
    "pwTraceKey": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^[A-Fa-f0-9]{64}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "threshold": {
      "anyOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        {
          "type": "null"
        }
      ]
    },
    "contentType": {
      "description": "Content type of the snapshot file",
      "type": "string"
    }
  },
  "required": [
    "key",
    "name"
  ]
}