{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/snapvisor-io/json-schema/snapvisor-io-snapshot-diff-schema.json",
  "title": "SnapshotDiff",
  "description": "Snapshot diff",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/snapvisor-io-openapi.yml#/components/schemas/SnapshotDiff",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier of the snapshot diff"
    },
    "name": {
      "type": "string",
      "description": "Name of the snapshot diff"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "removed",
        "failure",
        "added",
        "changed",
        "unchanged",
        "retryFailure",
        "ignored"
      ],
      "description": "Status of the snapshot diff"
    },
    "score": {
      "description": "Similarity score between snapshots",
      "type": [
        "number",
        "null"
      ]
    },
    "group": {
      "description": "Grouping key for the snapshot diff",
      "type": [
        "string",
        "null"
      ]
    },
    "parentName": {
      "description": "Parent name of the snapshot (usually the story id)",
      "type": [
        "string",
        "null"
      ]
    },
    "url": {
      "anyOf": [
        {
          "type": "string",
          "format": "uri"
        },
        {
          "type": "null"
        }
      ],
      "description": "URL of the diff image"
    },
    "base": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier of the snapshot"
            },
            "name": {
              "type": "string",
              "description": "Name of the snapshot"
            },
            "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"
                          ],
                          "additionalProperties": false,
                          "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"
                              ],
                              "additionalProperties": false
                            },
                            "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"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false,
                                "description": "A test annotation"
                              }
                            },
                            "tags": {
                              "description": "Tags associated to the test",
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "title",
                            "titlePath"
                          ],
                          "additionalProperties": false,
                          "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"
                          ],
                          "additionalProperties": false,
                          "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"
                      ],
                      "additionalProperties": false,
                      "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"
                      ],
                      "additionalProperties": false,
                      "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"
                          ],
                          "additionalProperties": false,
                          "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"
                          ],
                          "additionalProperties": false,
                          "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"
                  ],
                  "additionalProperties": false,
                  "description": "Metadata about a screenshot"
                },
                {
                  "type": "null"
                }
              ]
            },
            "width": {
              "description": "Width of the screenshot in pixels",
              "type": [
                "number",
                "null"
              ]
            },
            "height": {
              "description": "Height of the screenshot in pixels",
              "type": [
                "number",
                "null"
              ]
            },
            "url": {
              "type": "string",
              "format": "uri",
              "description": "Public URL of the snapshot"
            },
            "contentType": {
              "type": "string",
              "description": "Content type of the snapshot file"
            }
          },
          "required": [
            "id",
            "name",
            "metadata",
            "width",
            "height",
            "url",
            "contentType"
          ],
          "additionalProperties": false,
          "description": "Snapshot associated to a diff"
        },
        {
          "type": "null"
        }
      ]
    },
    "head": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier of the snapshot"
            },
            "name": {
              "type": "string",
              "description": "Name of the snapshot"
            },
            "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"
                          ],
                          "additionalProperties": false,
                          "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"
                              ],
                              "additionalProperties": false
                            },
                            "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"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false,
                                "description": "A test annotation"
                              }
                            },
                            "tags": {
                              "description": "Tags associated to the test",
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "title",
                            "titlePath"
                          ],
                          "additionalProperties": false,
                          "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"
                          ],
                          "additionalProperties": false,
                          "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"
                      ],
                      "additionalProperties": false,
                      "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"
                      ],
                      "additionalProperties": false,
                      "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"
                          ],
                          "additionalProperties": false,
                          "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"
                          ],
                          "additionalProperties": false,
                          "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"
                  ],
                  "additionalProperties": false,
                  "description": "Metadata about a screenshot"
                },
                {
                  "type": "null"
                }
              ]
            },
            "width": {
              "description": "Width of the screenshot in pixels",
              "type": [
                "number",
                "null"
              ]
            },
            "height": {
              "description": "Height of the screenshot in pixels",
              "type": [
                "number",
                "null"
              ]
            },
            "url": {
              "type": "string",
              "format": "uri",
              "description": "Public URL of the snapshot"
            },
            "contentType": {
              "type": "string",
              "description": "Content type of the snapshot file"
            }
          },
          "required": [
            "id",
            "name",
            "metadata",
            "width",
            "height",
            "url",
            "contentType"
          ],
          "additionalProperties": false,
          "description": "Snapshot associated to a diff"
        },
        {
          "type": "null"
        }
      ]
    },
    "test": {
      "anyOf": [
        {
          "$ref": "#/$defs/Test"
        },
        {
          "type": "null"
        }
      ]
    },
    "change": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier of the change (a test + fingerprint pair). Use it with the ignore/unignore endpoints."
            },
            "ignored": {
              "type": "boolean",
              "description": "Whether this change is currently ignored. Ignored changes no longer require review and are automatically approved."
            },
            "occurrences": {
              "type": "number",
              "description": "Number of times this change has been seen over the metrics period. A high count for a recurring change is a strong flakiness signal."
            }
          },
          "required": [
            "id",
            "ignored",
            "occurrences"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "name",
    "status",
    "score",
    "group",
    "parentName",
    "url",
    "base",
    "head",
    "test",
    "change"
  ],
  "additionalProperties": false,
  "$defs": {
    "Test": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier of the test"
        },
        "name": {
          "type": "string",
          "description": "Name of the test"
        },
        "buildName": {
          "type": "string",
          "description": "Name of the build the test belongs to"
        },
        "metrics": {
          "$ref": "#/$defs/TestMetrics"
        }
      },
      "required": [
        "id",
        "name",
        "buildName",
        "metrics"
      ],
      "additionalProperties": false,
      "description": "Test associated to a diff, with flakiness metrics to help decide whether a change is worth reviewing."
    },
    "TestMetrics": {
      "type": "object",
      "properties": {
        "total": {
          "type": "number",
          "description": "Number of builds in which this test ran over the metrics period."
        },
        "changes": {
          "type": "number",
          "description": "Number of times the test changed (produced a diff) over the metrics period."
        },
        "uniqueChanges": {
          "type": "number",
          "description": "Number of changes that were seen only once over the metrics period. A high ratio of unique changes is a strong flakiness signal."
        },
        "stability": {
          "type": "number",
          "description": "Ratio of builds without a change, between 0 and 1. `1` means the test never changed."
        },
        "consistency": {
          "type": "number",
          "description": "How consistent the changes are, between 0 and 1. `1` means changes repeat the same way; a low value means changes are erratic."
        },
        "flakiness": {
          "type": "number",
          "description": "Overall flakiness score between 0 and 1, derived from stability and consistency. `0` means stable, `1` means highly flaky."
        }
      },
      "required": [
        "total",
        "changes",
        "uniqueChanges",
        "stability",
        "consistency",
        "flakiness"
      ],
      "additionalProperties": false,
      "description": "Flakiness metrics of a test over the requested period."
    }
  }
}