{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.ringzero.tech/schemas/dependency-snapshot-part-v2.json",
  "title": "RingZero multipart dependency snapshot v2 part",
  "description": "One bounded UTF-8 request. Default maximum 2 MiB including envelope. Records may reference other parts. Complete validates reference consistency, node identities, context digests, and root module identities. No repository-wide count limit.",
  "type": "object",
  "required": [
    "records"
  ],
  "properties": {
    "records": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "type",
              "path"
            ],
            "properties": {
              "type": {
                "const": "module"
              },
              "path": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "teamName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "attributes": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128,
                  "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                },
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 512,
                  "pattern": "^[^\\u0000-\\u001f\\u007f]*$",
                  "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "module",
              "dependency"
            ],
            "properties": {
              "type": {
                "const": "moduleEdge"
              },
              "module": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "dependency": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "id",
              "name",
              "version"
            ],
            "properties": {
              "type": {
                "const": "node"
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "Exactly name + @ + version, at most 512 UTF-8 bytes."
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "id",
              "module",
              "context",
              "root"
            ],
            "properties": {
              "type": {
                "const": "context"
              },
              "id": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$",
                "description": "SHA-256 hex of UTF-8 module + NUL + configuration."
              },
              "module": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "context": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "root": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "contextId",
              "id"
            ],
            "properties": {
              "type": {
                "const": "vertex"
              },
              "contextId": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$",
                "description": "SHA-256 hex of UTF-8 module + NUL + configuration."
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "module": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "node": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              }
            },
            "oneOf": [
              {
                "required": [
                  "module"
                ],
                "not": {
                  "required": [
                    "node"
                  ]
                }
              },
              {
                "required": [
                  "node"
                ],
                "not": {
                  "required": [
                    "module"
                  ]
                }
              }
            ]
          },
          {
            "type": "object",
            "required": [
              "type",
              "contextId",
              "from",
              "to"
            ],
            "properties": {
              "type": {
                "const": "edge"
              },
              "contextId": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$",
                "description": "SHA-256 hex of UTF-8 module + NUL + configuration."
              },
              "from": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "to": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "cve",
              "reason"
            ],
            "properties": {
              "type": {
                "const": "suppression"
              },
              "cve": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "package": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "reason": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "pattern": "^[^\\u0000-\\u001f\\u007f]+$",
                "description": "At most 512 UTF-8 bytes; the server enforces the byte bound in addition to this character bound."
              },
              "expires": {
                "type": "string",
                "format": "date",
                "pattern": "^(?!0000)[0-9]{4}-[0-9]{2}-[0-9]{2}$"
              }
            }
          }
        ]
      }
    }
  }
}
