{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/optimizely/main/json-schema/optimizely-extension-update-schema.json",
  "title": "ExtensionUpdate",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/optimizely-extensions-api-openapi.yml#/components/schemas/ExtensionUpdate",
  "properties": {
    "archived": {
      "description": "Whether the extension is archived",
      "type": "boolean"
    },
    "description": {
      "description": "The description for the extension",
      "type": "string"
    },
    "edit_url": {
      "description": "The URL to load when editing the extension",
      "type": "string"
    },
    "enabled": {
      "description": "Whether the extension is enabled",
      "type": "boolean"
    },
    "fields": {
      "description": "Array of editable fields in the extension",
      "items": {
        "$ref": "#/$defs/Field"
      },
      "type": "array"
    },
    "implementation": {
      "$ref": "#/$defs/Implementation"
    },
    "name": {
      "description": "Name of the extension",
      "type": "string"
    }
  },
  "type": "object",
  "$defs": {
    "Choices": {
      "properties": {
        "label": {
          "description": "label of the choice",
          "type": "string"
        },
        "value": {
          "description": "value of the choice",
          "type": "string"
        }
      },
      "type": "object"
    },
    "Field": {
      "properties": {
        "api_name": {
          "description": "The API name of the field",
          "type": "string"
        },
        "default_value": {
          "description": "A string in JSON format that corresponds to the default_value of the field",
          "type": "string"
        },
        "field_type": {
          "description": "The type of the field",
          "enum": [
            "selector",
            "text",
            "multi_text",
            "rich_text",
            "number",
            "html",
            "css",
            "js",
            "toggle",
            "dropdown",
            "multi_select",
            "image",
            "color",
            "slider"
          ],
          "type": "string"
        },
        "label": {
          "description": "The label of the field",
          "type": "string"
        },
        "options": {
          "$ref": "#/$defs/Options"
        }
      },
      "required": [
        "api_name",
        "label",
        "default_value",
        "field_type"
      ],
      "type": "object"
    },
    "Implementation": {
      "properties": {
        "apply_js": {
          "default": "",
          "description": "The Apply JS code is used to inject the extension onto the page",
          "type": "string"
        },
        "css": {
          "default": "",
          "description": "Some extensions may not need any CSS because they inherit styles from the page itself. However, you can add additional styling here. This will be injected on the page through a <style> tag",
          "type": "string"
        },
        "html": {
          "default": "",
          "description": "The html implementation of the field",
          "type": "string"
        },
        "reset_js": {
          "default": "",
          "description": "Reset JS is used to \"clean up\" after a extension. It's used in the editor, when changing field values or removing an existing extension. Reset JS should remove the element and any other side-effects",
          "type": "string"
        }
      },
      "type": "object"
    },
    "Options": {
      "properties": {
        "choices": {
          "description": "The choices for a field",
          "items": {
            "$ref": "#/$defs/Choices"
          },
          "type": "array"
        }
      },
      "type": "object"
    }
  }
}