{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:provider-registry:0.1",
  "title": "Rejestr dostawców Junexis 0.1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "providers"],
  "properties": {
    "schemaVersion": { "const": "junexis.provider-registry/0.1" },
    "providers": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "providerVersion", "sdkVersion", "contract", "abiVersion", "path"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
          "providerVersion": { "$ref": "#/$defs/semver" },
          "sdkVersion": { "$ref": "#/$defs/semver" },
          "contract": { "const": "junexis.provider/0.2" },
          "abiVersion": { "const": "junexis.storage.runtime/0.1" },
          "path": {
            "type": "string",
            "pattern": "^packages/(?!\\.{1,2}(?:/|$))[A-Za-z0-9._-]+(?:/(?!\\.{1,2}(?:/|$))[A-Za-z0-9._-]+)*$"
          }
        }
      }
    }
  },
  "$defs": {
    "semver": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-((?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$"
    }
  }
}
