{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/one-s-service-descriptor/latest.json",
  "x-lintel": {
    "source": "https://www.schemastore.org/one-service-descriptor-schema-0.1.json",
    "sourceSha256": "5d8315c16a21c54a9b038df77cfdbb678d6da72897bb6ea3710fab5c536b53f3",
    "fileMatch": [
      "service-descriptor.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "$ref": "#/$defs/ServiceDescriptor",
  "$defs": {
    "ServiceDescriptor": {
      "type": "object",
      "title": "ServiceDescriptor",
      "properties": {
        "description": {
          "type": "string"
        },
        "requires": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Require"
          }
        },
        "events": {
          "$ref": "#/$defs/Events"
        }
      },
      "required": [
        "description",
        "requires",
        "events"
      ],
      "additionalProperties": false
    },
    "Events": {
      "type": "object",
      "title": "Events",
      "properties": {
        "produces": {
          "$ref": "#/$defs/Consumes"
        },
        "consumes": {
          "$ref": "#/$defs/Produces"
        }
      },
      "required": [
        "consumes",
        "produces"
      ],
      "additionalProperties": false
    },
    "Consumes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "title": "Consumes"
    },
    "Produces": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "title": "Produces"
    },
    "Require": {
      "type": "object",
      "title": "Require",
      "properties": {
        "service": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "uses": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Use"
          }
        }
      },
      "required": [
        "service",
        "uses",
        "version"
      ],
      "additionalProperties": false
    },
    "Use": {
      "type": "object",
      "title": "Use",
      "properties": {
        "api": {
          "type": "string",
          "enum": [
            "internal",
            "external",
            "integration"
          ]
        },
        "type": {
          "type": "string",
          "enum": [
            "REST",
            "library"
          ]
        }
      },
      "required": [
        "api",
        "type"
      ],
      "additionalProperties": false
    }
  }
}
