{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/invoicepdfs-com/json-schema/invoicepdfs-com-document-compliance-response-schema.json",
  "title": "DocumentComplianceResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/invoicepdfs-com-compliance-api-openapi.yml#/components/schemas/DocumentComplianceResponse",
  "properties": {
    "data": {
      "$ref": "#/$defs/ComplianceCheckOut"
    }
  },
  "type": "object",
  "required": [
    "data"
  ],
  "$defs": {
    "ComplianceCheckOut": {
      "properties": {
        "profile": {
          "type": "string",
          "title": "Profile"
        },
        "ruleset_version": {
          "type": "string",
          "title": "Ruleset Version",
          "description": "The version these rules came from. Worth recording alongside any document you file — rulesets revise, and 'which rules did this pass?' is what an audit asks years later. `rulesets` breaks the same answer down per ruleset."
        },
        "valid": {
          "type": "boolean",
          "title": "Valid",
          "description": "Nothing fatal was found. Read it with `fully_checked` — on its own it says what was checked came back clean, not that everything was checked."
        },
        "in_scope": {
          "type": "boolean",
          "title": "In Scope",
          "description": "Whether any of these rulesets is likely to apply to this document at all. False when neither party is in a country that uses one — these are European e-invoicing rulesets, and for a wholly domestic US invoice, say, `valid` is answering a question nobody asked. Advisory: it never changes the verdict or withholds the check, because an open network means a US seller invoicing a Dutch buyer genuinely needs it.",
          "default": true
        },
        "fully_checked": {
          "type": "boolean",
          "title": "Fully Checked",
          "description": "Every ruleset that applies to this profile ran. False means at least one could not, and `rulesets` says which and why.",
          "default": true
        },
        "rulesets": {
          "items": {
            "$ref": "#/$defs/ComplianceRulesetOut"
          },
          "type": "array",
          "title": "Rulesets",
          "description": "Every ruleset the document was held to, including the mandatory-field check, at the version that ran."
        },
        "violations": {
          "items": {
            "$ref": "#/$defs/ComplianceViolationOut"
          },
          "type": "array",
          "title": "Violations",
          "description": "Every violation found, not the first — fixing one field per round trip is the experience this avoids. Ordered mandatory-field findings first, since those name a field you can go and change."
        }
      },
      "type": "object",
      "required": [
        "profile",
        "ruleset_version",
        "valid"
      ],
      "title": "ComplianceCheckOut"
    },
    "ComplianceRulesetOut": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "label": {
          "type": "string",
          "title": "Label"
        },
        "version": {
          "type": "string",
          "title": "Version",
          "description": "The upstream release of the rules. Empty for checks with no version of their own.",
          "default": ""
        },
        "ran": {
          "type": "boolean",
          "title": "Ran",
          "description": "False when this ruleset could not be run at all. A ruleset that did not run is not a pass — `valid` only reports what was checked."
        },
        "reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason",
          "description": "Why it did not run, when it did not."
        }
      },
      "type": "object",
      "required": [
        "id",
        "label",
        "ran"
      ],
      "title": "ComplianceRulesetOut",
      "description": "One ruleset the document was held to, and whether it actually ran."
    },
    "ComplianceViolationOut": {
      "properties": {
        "rule": {
          "type": "string",
          "title": "Rule",
          "description": "The identifier the standard uses — a business term from the mandatory-field check, a rule id from Schematron. A rule id is what a rejection notice from an access point quotes."
        },
        "path": {
          "type": "string",
          "title": "Path",
          "description": "Where the problem is. The mandatory-field check names a field of the request; Schematron names the node in the generated XML."
        },
        "message": {
          "type": "string",
          "title": "Message"
        },
        "severity": {
          "type": "string",
          "title": "Severity",
          "description": "`fatal` would get the document rejected. `warning` is a recommendation — both EN 16931 and Peppol grade a large share of their rules as advisory, and `valid` ignores those.",
          "default": "fatal"
        },
        "ruleset": {
          "type": "string",
          "title": "Ruleset",
          "description": "Which ruleset found it — matches an `id` in `rulesets`.",
          "default": "semantic"
        }
      },
      "type": "object",
      "required": [
        "rule",
        "path",
        "message"
      ],
      "title": "ComplianceViolationOut"
    }
  }
}