{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/x-road-global/json-schema/x-road-global-service-schema.json",
  "title": "Service",
  "description": "service for the service description",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/x-road-global-security-server-admin-openapi.yml#/components/schemas/Service",
  "type": "object",
  "required": [
    "id",
    "service_code",
    "url",
    "timeout",
    "service_description_id",
    "client_id"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "text",
      "description": "encoded service id, including client id",
      "minLength": 1,
      "maxLength": 1279
    },
    "service_description_id": {
      "type": "string",
      "description": "unique identifier"
    },
    "client_id": {
      "type": "string",
      "format": "text",
      "description": "<instance_id>:<member_class>:<member_code>:<subsystem>(optional)",
      "minLength": 1,
      "maxLength": 255
    },
    "full_service_code": {
      "type": "string",
      "format": "text",
      "description": "encoded service code and version",
      "minLength": 1,
      "maxLength": 511
    },
    "service_code": {
      "type": "string",
      "format": "text",
      "description": "encoded service code",
      "minLength": 1,
      "maxLength": 255
    },
    "timeout": {
      "type": "integer",
      "format": "int32",
      "description": "service time out value",
      "minimum": 0,
      "maximum": 1000
    },
    "title": {
      "type": "string",
      "readOnly": true,
      "format": "text",
      "description": "service title",
      "minLength": 1,
      "maxLength": 255
    },
    "ssl_auth": {
      "type": "boolean",
      "description": "service ssl auth"
    },
    "subjects_count": {
      "type": "integer",
      "format": "int32",
      "description": "count of acl subjects",
      "minimum": 0,
      "maximum": 100000
    },
    "url": {
      "type": "string",
      "format": "url",
      "description": "service url",
      "minLength": 1,
      "maxLength": 255
    },
    "endpoints": {
      "type": "array",
      "description": "list of endpoints linked to this service",
      "items": {
        "$ref": "#/$defs/Endpoint"
      }
    }
  },
  "$defs": {
    "Endpoint": {
      "type": "object",
      "description": "Endpoint for a service",
      "required": [
        "service_code",
        "method",
        "path"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "unique identifier"
        },
        "service_code": {
          "type": "string",
          "description": "service code"
        },
        "client_id": {
          "type": "string",
          "format": "text",
          "description": "<instance_id>:<member_class>:<member_code>:<subsystem>(optional)",
          "readOnly": true,
          "minLength": 1,
          "maxLength": 255
        },
        "method": {
          "type": "string",
          "description": "http method mapped to this endpoint",
          "enum": [
            "*",
            "GET",
            "POST",
            "PUT",
            "DELETE",
            "PATCH",
            "HEAD",
            "OPTIONS",
            "TRACE"
          ]
        },
        "path": {
          "type": "string",
          "description": "relative path where this endpoint is mapped to"
        },
        "generated": {
          "type": "boolean",
          "description": "has endpoint been generated from openapi3 description",
          "readOnly": true
        }
      }
    }
  }
}