{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/revyl/json-schema/revyl-update-module-request-schema.json",
  "title": "UpdateModuleRequest",
  "description": "Request model for updating an existing module",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/revyl-modules-api-openapi.yml#/components/schemas/UpdateModuleRequest",
  "properties": {
    "blocks": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/ModuleBlock"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "description": "New blocks array",
      "title": "Blocks"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "New description",
      "title": "Description"
    },
    "expected_version": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Expected version for optimistic locking",
      "title": "Expected Version"
    },
    "name": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "New name",
      "title": "Name"
    }
  },
  "type": "object",
  "$defs": {
    "ModuleBlock": {
      "description": "Individual block within a module - matches FrontendBlock structure.\n\nThe id field is auto-generated if not provided, so blocks from any client\n(frontend, CLI, direct API) are always stored with valid IDs.",
      "properties": {
        "children": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ModuleBlock"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Children"
        },
        "condition": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Condition"
        },
        "elseChildren": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ModuleBlock"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Elsechildren"
        },
        "file": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "File"
        },
        "file_uri": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "File Uri"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Block ID (auto-generated if not provided)",
          "title": "Id"
        },
        "module": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Module"
        },
        "module_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Module Id"
        },
        "script": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Script"
        },
        "script_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Script Id"
        },
        "step_description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Step Description"
        },
        "step_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Step Type"
        },
        "thenChildren": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ModuleBlock"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Thenchildren"
        },
        "type": {
          "title": "Type",
          "type": "string"
        },
        "variable_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Variable Name"
        },
        "variable_scope": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Variable Scope"
        }
      },
      "required": [
        "type"
      ],
      "title": "ModuleBlock",
      "type": "object"
    }
  }
}