{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/superflag-sh/json-schema/superflag-sh-flag-patch-request-schema.json",
  "title": "FlagPatchRequest",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/superflag-sh-openapi.json#/components/schemas/FlagPatchRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "appId",
    "env",
    "key"
  ],
  "properties": {
    "appId": {
      "type": "string",
      "minLength": 1
    },
    "env": {
      "type": "string",
      "minLength": 1
    },
    "key": {
      "type": "string",
      "minLength": 1
    },
    "mode": {
      "enum": [
        "create",
        "update",
        "upsert"
      ],
      "default": "upsert"
    },
    "toggle": {
      "type": "boolean",
      "default": false
    },
    "type": {
      "enum": [
        "bool",
        "string",
        "number",
        "json"
      ]
    },
    "value": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "array",
          "items": {}
        },
        {
          "type": "object",
          "additionalProperties": true
        }
      ]
    },
    "rollout": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "percentage"
          ],
          "properties": {
            "percentage": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "variants": {
      "oneOf": [
        {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "value",
              "weight"
            ],
            "properties": {
              "value": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "array",
                    "items": {}
                  },
                  {
                    "type": "object",
                    "additionalProperties": true
                  }
                ]
              },
              "weight": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "name": {
                "type": "string"
              }
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "clientEnabled": {
      "type": [
        "boolean",
        "null"
      ]
    }
  }
}