{
  "$id": "https://json.schemastore.org/drupal-libraries.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "version": {
        "title": "The library version",
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          }
        ]
      },
      "remote": {
        "title": "The library repository URL",
        "type": "string"
      },
      "license": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "title": "The human-readable name of the license",
            "type": "string"
          },
          "url": {
            "title": "The URL of the license file/information for the version of the library used",
            "type": "string"
          },
          "gpl-compatible": {
            "title": "A boolean for whether this library is GPL compatible",
            "type": "boolean"
          }
        }
      },
      "header": {
        "title": "A boolean for whether the script must be included in the header",
        "type": "boolean"
      },
      "drupalSettings": {
        "title": "Settings that needs to be attached to drupalSettings object in JavaScript",
        "type": "object"
      },
      "js": {
        "title": "List of JavaScript files to load",
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "$ref": "#/definitions/file",
          "properties": {
            "cache": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        }
      },
      "css": {
        "title": "List of CSS files to load",
        "type": "object",
        "properties": {
          "base": {
            "$ref": "#/definitions/cssFiles"
          },
          "layout": {
            "$ref": "#/definitions/cssFiles"
          },
          "component": {
            "$ref": "#/definitions/cssFiles"
          },
          "theme": {
            "$ref": "#/definitions/cssFiles"
          },
          "state": {
            "$ref": "#/definitions/cssFiles"
          }
        }
      },
      "dependencies": {
        "title": "List libraries that should be loaded along with this library",
        "type": "array",
        "items": {
          "type": "string",
          "pattern": "^.+/.+$"
        }
      }
    }
  },
  "definitions": {
    "file": {
      "type": "object",
      "properties": {
        "attributes": {
          "title": "Optional attributes",
          "type": "object"
        },
        "browsers": {
          "title": "Load asset conditionally based on browser",
          "type": "object"
        },
        "minified": {
          "title": "Whether the asset is already minified",
          "type": "boolean"
        },
        "external": {
          "type": "boolean"
        },
        "type": {
          "title": "The source of the asset",
          "type": "string"
        },
        "preprocess": {
          "title": "Whether the assets should be aggregated",
          "type": "boolean"
        },
        "weight": {
          "title": "The order relative to other assets",
          "type": "integer"
        }
      }
    },
    "cssFiles": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "$ref": "#/definitions/file",
        "properties": {
          "group": {
            "title": "The SMACSS group in which the asset is placed",
            "type": "integer"
          },
          "media": {
            "title": "Media type",
            "type": "string",
            "enum": ["all", "screen", "print", "speech"]
          }
        },
        "additionalProperties": false
      }
    }
  },
  "title": "JSON schema for Drupal libraries file",
  "type": "object"
}
