{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atlar/json-schema/atlar-glentity-jsonpatch-request-schema.json",
  "title": "GLEntityJSONPatchRequest",
  "description": "JSON Patch Request",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/atlar-gl-entities-api-openapi.yml#/components/schemas/GLEntityJSONPatchRequest",
  "type": "array",
  "items": {
    "oneOf": [
      {
        "$ref": "#/$defs/GLEntityJSONPatchReplaceEntityId"
      },
      {
        "$ref": "#/$defs/GLEntityJSONPatchRemoveEntityId"
      },
      {
        "$ref": "#/$defs/GLEntityJSONPatchReplaceCurrency"
      }
    ]
  },
  "$defs": {
    "CurrencyCode": {
      "type": "string",
      "description": "Three-letter ISO 4217 currency code.",
      "minLength": 3,
      "maxLength": 3,
      "pattern": "^[A-Z]{3,3}$"
    },
    "GLEntityJSONPatchRemoveEntityId": {
      "description": "Unset the Atlar entity identifier that corresponds to this GL entity.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "remove"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/entityId"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path"
      ]
    },
    "GLEntityJSONPatchReplaceCurrency": {
      "description": "Set the base currency of the GL entity when known from the ERP.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "replace"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/currency"
          ]
        },
        "value": {
          "$ref": "#/$defs/CurrencyCode"
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "GLEntityJSONPatchReplaceEntityId": {
      "description": "Set the Atlar entity identifier that corresponds to this GL entity.",
      "type": "object",
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "replace"
          ]
        },
        "path": {
          "type": "string",
          "enum": [
            "/entityId"
          ]
        },
        "value": {
          "$ref": "#/$defs/ResourceID"
        }
      },
      "additionalProperties": false,
      "required": [
        "op",
        "path",
        "value"
      ]
    },
    "ResourceID": {
      "type": "string",
      "description": "Unique resource identifier.",
      "minLength": 32,
      "maxLength": 64
    }
  }
}