{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nodcheck-com/json-schema/nodcheck-com-check-request-schema.json",
  "title": "CheckRequest",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nodcheck-com-openapi.json#/components/schemas/CheckRequest",
  "type": "object",
  "required": [
    "criteria"
  ],
  "properties": {
    "criteria": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/Criterion"
      }
    },
    "evidence": {
      "type": "object",
      "description": "Whatever you want us to reconcile; its key names must match the key/path used in criteria"
    },
    "pay": {
      "type": "object",
      "description": "Pay with this once the free credit is used up. data accepts any JSON; only its sha256 fingerprint is kept, never the content.",
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "enum": [
            "run_check",
            "trace",
            "compute",
            "referral"
          ]
        },
        "data": {
          "description": "Any JSON"
        }
      }
    }
  },
  "$defs": {
    "Criterion": {
      "oneOf": [
        {
          "type": "string",
          "description": "Natural language; we do our best to parse it into a mechanically checkable form"
        },
        {
          "type": "object",
          "required": [
            "type",
            "key"
          ],
          "properties": {
            "type": {
              "const": "evidence_present",
              "description": "The evidence item exists and is not empty"
            },
            "key": {
              "type": "string",
              "description": "Key name inside evidence; dotted paths (a.b) are supported"
            },
            "negate": {
              "type": "boolean",
              "description": "(optional) true = this criterion must **NOT** hold (e.g. no key may appear, no error may appear)"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "type",
            "path",
            "sha256"
          ],
          "properties": {
            "type": {
              "const": "hash_matches",
              "description": "The declared sha256 matches the actual content"
            },
            "path": {
              "type": "string",
              "description": "Key name inside evidence"
            },
            "sha256": {
              "type": "string",
              "description": "64 lowercase hex characters"
            },
            "negate": {
              "type": "boolean",
              "description": "(optional) true = this criterion must **NOT** hold (e.g. no key may appear, no error may appear)"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "type",
            "url",
            "expect"
          ],
          "properties": {
            "type": {
              "const": "url_status",
              "description": "The URL returns the expected status code"
            },
            "url": {
              "type": "string",
              "description": "http(s) URL"
            },
            "expect": {
              "type": "integer",
              "description": "Integer status code, e.g. 200"
            },
            "render": {
              "type": "boolean",
              "description": "(optional) true = render in a real browser first (required for JS-rendered pages)"
            },
            "negate": {
              "type": "boolean",
              "description": "(optional) true = this criterion must **NOT** hold (e.g. no key may appear, no error may appear)"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "type",
            "url",
            "contains"
          ],
          "properties": {
            "type": {
              "const": "url_contains",
              "description": "The URL content contains the given string"
            },
            "url": {
              "type": "string",
              "description": "http(s) URL"
            },
            "contains": {
              "type": "string",
              "description": "The string to look for (case-sensitive)"
            },
            "render": {
              "type": "boolean",
              "description": "(optional) true = render in a real browser first (required for JS-rendered pages)"
            },
            "negate": {
              "type": "boolean",
              "description": "(optional) true = this criterion must **NOT** hold (e.g. no key may appear, no error may appear)"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "type",
            "path"
          ],
          "properties": {
            "type": {
              "const": "json_path",
              "description": "A path inside evidence exists / equals the given value"
            },
            "path": {
              "type": "string",
              "description": "Key name inside evidence; dotted paths (a.b) are supported"
            },
            "equals": {
              "description": "(optional) expected value; if omitted, only existence is checked"
            },
            "negate": {
              "type": "boolean",
              "description": "(optional) true = this criterion must **NOT** hold (e.g. no key may appear, no error may appear)"
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "type",
            "path",
            "min"
          ],
          "properties": {
            "type": {
              "const": "count_min",
              "description": "A list has at least N items"
            },
            "path": {
              "type": "string",
              "description": "Key name inside evidence (array: length; object: key count; number: the value itself)"
            },
            "min": {
              "type": "integer",
              "description": "Integer lower bound"
            },
            "negate": {
              "type": "boolean",
              "description": "(optional) true = this criterion must **NOT** hold (e.g. no key may appear, no error may appear)"
            }
          },
          "additionalProperties": false
        }
      ]
    }
  }
}