Draft v0.1 — published for review. Not final until approved; may change incompatibly before 1.0.

Isto Intents common definitions

common.schema.json · raw JSON · JSON Schema 2020-12

$id: https://istointents.org/schemas/0.1/common.schema.json

Definitions#

nametypedescription
version"0.1"
idstring (uri)
timestampstring (date-time)
datestring (date)
countrystring (pattern ^[A-Z]{2}$)
regionstring (pattern ^[A-Z]{2}-[A-Z0-9]{1,3}$)
currencystring (pattern ^[A-Z]{3}$)
languagestring (pattern ^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$)
categoryanyOf: "vehicle" | "property", string (uri, pattern ^https?://)
amountinteger (≥ 0)
partyobject
geoobject
areaoneOf: object, object, object
sealedobjectA sealed value: opaque to everyone but the holder that sealed it (spec §4.2). Never a plain number.
extensionsobject

party

fieldtyperequireddescription
ididyes
namestring

geo

fieldtyperequireddescription
latnumber (≥ -90, ≤ 90)yes
lonnumber (≥ -180, ≤ 180)yes

sealed

fieldtyperequireddescription
schemestringyesholder-defined identifier of the sealing scheme
ciphertextstringyes
keyIdstringyes

Full schema#

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://istointents.org/schemas/0.1/common.schema.json",
  "title": "Isto Intents common definitions",
  "$defs": {
    "version": {
      "const": "0.1"
    },
    "id": {
      "type": "string",
      "format": "uri",
      "minLength": 3
    },
    "timestamp": {
      "type": "string",
      "format": "date-time"
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "country": {
      "type": "string",
      "pattern": "^[A-Z]{2}$"
    },
    "region": {
      "type": "string",
      "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$"
    },
    "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
    },
    "language": {
      "type": "string",
      "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
    },
    "category": {
      "anyOf": [
        {
          "enum": [
            "vehicle",
            "property"
          ]
        },
        {
          "type": "string",
          "format": "uri",
          "pattern": "^https?://"
        }
      ]
    },
    "amount": {
      "type": "integer",
      "minimum": 0
    },
    "party": {
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "geo": {
      "type": "object",
      "required": [
        "lat",
        "lon"
      ],
      "properties": {
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "lon": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        }
      },
      "additionalProperties": false
    },
    "area": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "center",
            "radiusKm"
          ],
          "properties": {
            "center": {
              "$ref": "#/$defs/geo"
            },
            "radiusKm": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 1000
            }
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "required": [
            "regions"
          ],
          "properties": {
            "regions": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/region"
              }
            }
          },
          "additionalProperties": false
        },
        {
          "description": "Whole LAU 1 units (administrative districts, e.g. SK0203, CZ0642).",
          "type": "object",
          "required": [
            "lau"
          ],
          "properties": {
            "lau": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "pattern": "^[A-Z]{2}[0-9A-Z]{2,8}$"
              }
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "sealed": {
      "description": "A sealed value: opaque to everyone but the holder that sealed it (spec §4.2). Never a plain number.",
      "type": "object",
      "required": [
        "scheme",
        "ciphertext",
        "keyId"
      ],
      "properties": {
        "scheme": {
          "type": "string",
          "minLength": 1,
          "description": "holder-defined identifier of the sealing scheme"
        },
        "ciphertext": {
          "type": "string",
          "minLength": 16
        },
        "keyId": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "extensions": {
      "type": "object",
      "propertyNames": {
        "anyOf": [
          {
            "pattern": "^x-"
          },
          {
            "format": "uri"
          }
        ]
      }
    }
  }
}