{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "additionalProperties": false,
  "id": "https://json.schemastore.org/cosmos-config.json",
  "properties": {
    "$schema": {
      "type": "string"
    },
    "rootDir": {
      "description": "The root directory that all others paths in this config are relative to. Usually the root of your repo. If omitted, rootDir is equal to the directory containing your Cosmos config. When you don't use a Cosmos config, rootDir defaults to the current working directory.",
      "type": "string",
      "minLength": 1
    },
    "exportPath": {
      "description": "Where to generate static exports on disk. [default: \"cosmos-export\"]",
      "type": "string",
      "minLength": 1
    },
    "detectLocalPlugins": {
      "description": "Automatically detect and load local plugins",
      "type": "boolean"
    },
    "disablePlugins": {
      "description": "Disable plugins",
      "type": "boolean"
    },
    "staticPath": {
      "description": "Dir path to serve static assets from.",
      "type": "string",
      "minLength": 1
    },
    "plugins": {
      "description": "Module IDs of Cosmos plugins (eg. \"react-cosmos-plugin-open-fixture\" or \"../path/to/my-plugin\").",
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "publicUrl": {
      "description": "Base URL for static assets. [default: \"/\"]",
      "type": "string"
    },
    "fixturesDir": {
      "description": "Name for directories that contain fixtures (eg. __fixtures__/example.jsx). [default: \"__fixtures__\"]",
      "type": "string",
      "minLength": 1
    },
    "fixtureFileSuffix": {
      "description": "Suffix for fixture files (eg. example.fixture.jsx). [default: \"fixture\"]",
      "type": "string",
      "minLength": 1
    },
    "ignore": {
      "description": "Patterns for ignoring fixture and decorator files (eg. [\"**/dist/**\"]]).",
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "watchDirs": {
      "description": "Directories where the Cosmos server watches for fixture files changes while running. [default: [\".\"]]",
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "lazy": {
      "description": "Dynamically import fixture and decorator modules as they are loaded. When false all fixture and decorator modules are imported statically and bundled together. [default: false]",
      "type": "boolean"
    },
    "exposeImports": {
      "description": "Expose user imports and config required for the Cosmos renderer. Used with React Native and in custom integrations. When a path is specified it requires a file extension (eg. \"src/cosmos.imports.ts\"). [default: false]",
      "anyOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "boolean"
        }
      ]
    },
    "hostname": {
      "description": "Dev server hostname. Set to null to accept connections with any hostname. [default: null]",
      "anyOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "null"
        }
      ]
    },
    "port": {
      "description": "Dev server port. [default: 5000]",
      "type": "number"
    },
    "portRetries": {
      "description": "Max number of port retries. [default: 10]",
      "type": "number"
    },
    "https": {
      "description": "Server will be served over HTTPS.",
      "type": "boolean"
    },
    "httpsOptions": {
      "description": "Additional options for HTTPS server.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "certPath": {
          "description": "Path of a certificate file",
          "type": "string"
        },
        "keyPath": {
          "description": "Path of a certificate's key file",
          "type": "string"
        }
      }
    },
    "httpProxy": {
      "description": "Proxy some URLs to a different HTTP server (eg. an API backend dev server). Similar to devServer.proxy in webpack config.",
      "type": "object",
      "additionalProperties": true,
      "patternProperties": {
        ".*": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "description": "Advanced HTTP proxy config.",
              "additionalProperties": true,
              "required": ["target"],
              "properties": {
                "target": {
                  "type": "string"
                },
                "secure": {
                  "type": "boolean"
                },
                "pathRewrite": {
                  "type": "object",
                  "patternProperties": {
                    ".*": {
                      "type": "string"
                    }
                  }
                },
                "logLevel": {
                  "type": "string",
                  "enum": ["error", "debug", "info", "warn", "silent"]
                }
              }
            }
          ]
        }
      }
    },
    "globalImports": {
      "description": "Modules to be imported before loading components. Stuff like reset.css, polyfills, etc.",
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "rendererUrl": {
      "description": "Required when renderer doesn't run on the same port (or host) as the Playground. Useful for integrations with build tools. [default: null]",
      "anyOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "null"
        }
      ]
    },
    "dom": {
      "description": "DOM-related options",
      "type": "object",
      "properties": {
        "containerQuerySelector": {
          "description": "Document selector for existing element to use as component parent (eg. #root). A blank container element is created from scratch if no selector is provided. [default: null]",
          "type": ["string", "null"],
          "minLength": 1
        }
      }
    },
    "vite": {
      "description": "Vite-related options",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "configPath": {
          "description": "Path to Vite config. Set to false to disable reading it from the default path. [default: \"vite.config.js\"]",
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "enum": [false]
            }
          ]
        },
        "indexPath": {
          "description": "Path to index module (eg. \"src/my-index.tsx\"). [default: matches common index/main module paths]",
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "port": {
          "description": "Vite renderer port. [default: 5050]",
          "type": "number"
        }
      }
    },
    "webpack": {
      "description": "Webpack-related options",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "configPath": {
          "description": "Path to an existing webpack config, which Cosmos will reuse to build your code. Set to null to disable this behavior. [default: \"webpack.config.js\"]",
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "overridePath": {
          "description": "Path to a user module that customizes the webpack config used by Cosmos. Set to null to disable this behavior. [default: \"webpack.override.js\"]",
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "includeHashInOutputFilename": {
          "description": "Changes output filename from \"[name].js\" to \"[name].[contenthash].js\". [default: false]",
          "type": "boolean"
        },
        "hotReload": {
          "description": "Enable webpack's Hot Module Replacement. [default: true]",
          "type": "boolean"
        },
        "reloadOnFail": {
          "description": "When using webpack's Hot Module Replacement, enable automatic location reload after webpack fails to update modules. [default: false]",
          "type": "boolean"
        }
      }
    },
    "ui": {
      "description": "UI plugin options",
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "responsivePreview": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "devices": {
              "description": "List of device viewports",
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["label", "width", "height"],
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1
                  },
                  "width": {
                    "type": "number",
                    "minimum": 1
                  },
                  "height": {
                    "type": "number",
                    "minimum": 1
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "title": "JSON schema for React Cosmos configs",
  "type": "object"
}
