{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/wisepim/json-schema/wisepim-gtin-result-schema.json",
  "title": "GtinResult",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/wisepim-openapi.json#/components/schemas/GtinResult",
  "type": "object",
  "required": [
    "input",
    "valid",
    "format",
    "checkDigit",
    "expectedCheckDigit",
    "gtin14",
    "gs1Prefix",
    "error"
  ],
  "properties": {
    "input": {
      "type": "string"
    },
    "valid": {
      "type": "boolean"
    },
    "format": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "EAN-13",
        "EAN-8",
        "UPC-A",
        "ISBN-13",
        "GTIN-14",
        null
      ]
    },
    "checkDigit": {
      "type": [
        "integer",
        "null"
      ]
    },
    "expectedCheckDigit": {
      "type": [
        "integer",
        "null"
      ]
    },
    "gtin14": {
      "type": [
        "string",
        "null"
      ],
      "description": "The code zero-padded to 14 digits, when valid."
    },
    "gs1Prefix": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "prefix": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "country",
            "organization",
            "unassigned"
          ]
        },
        "regions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "ISO 3166-1 alpha-2 codes."
        }
      }
    },
    "error": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "empty",
            "nonDigit",
            "length",
            "checkDigit"
          ]
        },
        "message": {
          "type": "string"
        }
      }
    },
    "attribution": {
      "$ref": "#/$defs/Attribution"
    }
  },
  "$defs": {
    "Attribution": {
      "type": "object",
      "description": "Credit to show wherever the data appears: a visible link with the text \"Data by WISEPIM\" to `url`.",
      "required": [
        "required",
        "text",
        "url",
        "html",
        "markdown",
        "terms"
      ],
      "properties": {
        "required": {
          "type": "boolean",
          "const": true
        },
        "text": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "html": {
          "type": "string"
        },
        "markdown": {
          "type": "string"
        },
        "terms": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}