{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/pagopa/main/json-schema/pagopa-problem-schema.json",
  "title": "Problem",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pagopa-pdnd-interop-v2-openapi.yml#/components/schemas/Problem",
  "properties": {
    "type": {
      "description": "URI reference of type definition",
      "type": "string"
    },
    "status": {
      "description": "The HTTP status code generated by the origin server for this occurrence of the problem",
      "exclusiveMaximum": true,
      "format": "int32",
      "maximum": 600,
      "minimum": 100,
      "type": "integer"
    },
    "title": {
      "description": "A short, summary of the problem type. Written in english and readable",
      "maxLength": 64,
      "pattern": "^[ -~]{0,64}$",
      "type": "string"
    },
    "correlationId": {
      "description": "Unique identifier of the request",
      "maxLength": 64,
      "type": "string"
    },
    "detail": {
      "description": "A human readable explanation of the problem",
      "maxLength": 4096,
      "pattern": "^.{0,1024}$",
      "type": "string"
    },
    "errors": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/ProblemError"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "type",
    "status",
    "title"
  ],
  "$defs": {
    "ProblemError": {
      "properties": {
        "code": {
          "description": "Internal code of the error",
          "minLength": 8,
          "maxLength": 8,
          "pattern": "^[0-9]{3}-[0-9]{4}$",
          "type": "string"
        },
        "detail": {
          "description": "A human readable explanation specific to this occurrence of the problem",
          "maxLength": 4096,
          "pattern": "^.{0,1024}$",
          "type": "string"
        }
      },
      "required": [
        "code",
        "detail"
      ]
    }
  }
}