{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/registry/extensions.schema.json",
  "$comment": "Written by hand from spec Part I, 11, registry/README.md and Part VI, 8.1.1 (of 0.5), not generated. The registry is not versioned, and this is its schema, which its tests hold it to. The copies in schemas/registry/ (0.1's) and in schemas/0.2/, 0.3/ and 0.4/ are those versions' own, as their tags keep them, and do not change; the copies in schemas/0.5/ to 0.8/ are the cuts', which hold an entry's open as this schema does.",
  "title": "Extension registry",
  "description": "The prefixes registered for applications' extensions, and the names OpenEik reserves (spec Part I, 11.1): registry/extensions.json in the specification's repository. The rules a schema cannot state (each name once and in order, no prefix reserved, none given to another registrant) are checked by the repository's tests and kept by its editors. Unlike the schemas of a model's files, which keep the members they do not know (Part I, 10), this schema refuses them: the registry is edited by hand and read by tools, and a misspelt member (contacts for contact) would otherwise pass unnoticed.",
  "type": "object",
  "properties": {
    "prefixes": {
      "description": "The registered prefixes, in the order of their names.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/registration"
      }
    },
    "reserved": {
      "description": "The names no application registers: the standard's own, and the folders at the top of a model's folder, now and planned. A name that ends in -* reserves every prefix that starts with it but for the star.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/reservation"
      }
    }
  },
  "required": [
    "prefixes",
    "reserved"
  ],
  "additionalProperties": false,
  "$defs": {
    "prefix": {
      "description": "A prefix (Part I, 11.1, rule 1): 2 to 32 lowercase ASCII letters, digits and hyphens, from a letter to a letter or a digit, no two hyphens side by side, and no device name of a common operating system.",
      "type": "string",
      "minLength": 2,
      "maxLength": 32,
      "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$",
      "not": {
        "pattern": "^(con|prn|aux|nul|com[0-9]|lpt[0-9])$"
      }
    },
    "date": {
      "description": "A day, as YYYY-MM-DD.",
      "type": "string",
      "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$"
    },
    "registration": {
      "description": "A registered prefix.",
      "type": "object",
      "properties": {
        "prefix": {
          "$ref": "#/$defs/prefix"
        },
        "registrant": {
          "description": "Who registered it: the organisation, project or person that makes the application, as it wants to be named.",
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "contact": {
          "description": "How to reach whoever answers for the prefix: an email address (a role address rather than a person's) or an https URL (an issue tracker, a contact page).",
          "type": "string",
          "pattern": "^([^@\\s]+@[^@\\s]+\\.[^@\\s]+|https://[^\\s]+)$"
        },
        "description": {
          "description": "What the application is and what its extension adds, in a sentence or two.",
          "type": "string",
          "minLength": 1,
          "maxLength": 280
        },
        "url": {
          "description": "Where the extension's members and files are described, if anywhere.",
          "type": "string",
          "pattern": "^https://[^\\s]+$"
        },
        "open": {
          "description": "Where the application opens one of its folders, if it does (Part VI, 8.1.1, of 0.5; open questions, 135): an https URL with no query and no fragment, to which a host adds the query that names the store, the building, the version, the model folder and, where it names one, the run.",
          "type": "string",
          "pattern": "^https://[^\\s?#]+$"
        },
        "registered": {
          "description": "The day the registration was merged.",
          "$ref": "#/$defs/date"
        },
        "withdrawn": {
          "description": "The day its registrant withdrew it, if it did. A withdrawn prefix is never registered again (Part I, 11.1, rule 4).",
          "$ref": "#/$defs/date"
        },
        "notes": {
          "description": "The editors' notes: what a version of OpenEik took into the core, in which version and under which name (Part I, 11.4), or a change of registrant.",
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "prefix",
        "registrant",
        "contact",
        "description",
        "registered"
      ],
      "additionalProperties": false
    },
    "reservation": {
      "description": "A name OpenEik reserves.",
      "type": "object",
      "properties": {
        "name": {
          "description": "A prefix, or a prefix and -* for every prefix that starts with that prefix and a hyphen.",
          "anyOf": [
            {
              "$ref": "#/$defs/prefix"
            },
            {
              "type": "string",
              "maxLength": 32,
              "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*-[*]$"
            }
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "name",
        "reason"
      ],
      "additionalProperties": false
    }
  }
}
