{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/dart-build",
  "$ref": "#/definitions/buildConfig",
  "definitions": {
    "_listOfGlobs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "buildConfig": {
      "type": "object",
      "properties": {
        "targets": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/buildTarget"
          },
          "propertyNames": {
            "$ref": "#/definitions/targetKey"
          }
        },
        "builders": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/builderDefinition"
          },
          "propertyNames": {
            "$ref": "#/definitions/builderKey"
          }
        },
        "post_process_builders": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/postProcessBuilderDefinition"
          }
        },
        "global_options": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/globalBuilderOptions"
          }
        },
        "additional_public_assets": {
          "$ref": "#/definitions/_listOfGlobs"
        }
      },
      "additionalProperties": false
    },
    "buildTarget": {
      "type": "object",
      "properties": {
        "auto_apply_builders": {
          "type": "boolean",
          "default": true
        },
        "builders": {
          "type": "object",
          "propertyNames": {
            "$ref": "#/definitions/builderKey"
          },
          "additionalProperties": {
            "$ref": "#/definitions/targetBuilderConfig"
          }
        },
        "dependencies": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/targetKey"
          }
        },
        "sources": {
          "$ref": "#/definitions/inputSet"
        }
      },
      "additionalProperties": false
    },
    "builderDefinition": {
      "type": "object",
      "properties": {
        "builder_factories": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "import": {
          "type": "string"
        },
        "build_extensions": {
          "type": "object",
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "auto_apply": {
          "$ref": "#/definitions/autoApply",
          "default": "none"
        },
        "required_inputs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "runs_before": {
          "$ref": "#/definitions/runsBefore"
        },
        "applies_builders": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/builderKey"
          }
        },
        "is_optional": {
          "type": "boolean",
          "default": false
        },
        "build_to": {
          "$ref": "#/definitions/buildTo",
          "default": "cache"
        },
        "defaults": {
          "$ref": "#/definitions/targetBuilderConfigDefaults"
        },
        "target": {
          "type": "string",
          "title": "The name of the dart_library target that contains the import",
          "deprecated": true,
          "deprecationMessage": "May be null or unreliable and should not be used."
        }
      },
      "additionalProperties": false
    },
    "postProcessBuilderDefinition": {
      "type": "object",
      "properties": {
        "builder_factory": {
          "type": "string"
        },
        "import": {
          "type": "string"
        },
        "input_extensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "defaults": {
          "$ref": "#/definitions/targetBuilderConfigDefaults"
        }
      },
      "additionalProperties": false
    },
    "inputSet": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "include": {
              "$ref": "#/definitions/_listOfGlobs"
            },
            "exclude": {
              "$ref": "#/definitions/_listOfGlobs"
            }
          },
          "additionalProperties": false
        },
        {
          "$comment": "Use List<String> directly, inferred to mean include.",
          "$ref": "#/definitions/_listOfGlobs"
        }
      ]
    },
    "targetBuilderConfig": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "generate_for": {
          "$ref": "#/definitions/inputSet"
        },
        "options": {
          "$ref": "#/definitions/builderOptions"
        },
        "dev_options": {
          "$ref": "#/definitions/builderOptions"
        },
        "release_options": {
          "$ref": "#/definitions/builderOptions"
        }
      },
      "additionalProperties": false
    },
    "targetBuilderConfigDefaults": {
      "type": "object",
      "properties": {
        "generate_for": {
          "$ref": "#/definitions/inputSet"
        },
        "options": {
          "$ref": "#/definitions/builderOptions"
        },
        "dev_options": {
          "$ref": "#/definitions/builderOptions"
        },
        "release_options": {
          "$ref": "#/definitions/builderOptions"
        }
      },
      "additionalProperties": false
    },
    "globalBuilderOptions": {
      "type": "object",
      "properties": {
        "options": {
          "$ref": "#/definitions/builderOptions"
        },
        "dev_options": {
          "$ref": "#/definitions/builderOptions"
        },
        "release_options": {
          "$ref": "#/definitions/builderOptions"
        },
        "runs_before": {
          "$ref": "#/definitions/runsBefore"
        }
      },
      "additionalProperties": false
    },
    "builderOptions": {
      "type": "object",
      "title": "Options to apply to a builder",
      "description": "An arbitrary Map<String, dynamic> of configuration options exposed by the individual builders. See the documentation for the builder you are configuring for guidance.",
      "additionalProperties": true
    },
    "autoApply": {
      "type": "string",
      "description": "On which packages the builder is applied by default",
      "enum": ["none", "dependents", "all_packages", "root_package"]
    },
    "buildTo": {
      "type": "string",
      "description": "Whether the outputs should be stored in a hidden cache or in the source directory.",
      "enum": ["cache", "source"]
    },
    "targetKey": {
      "type": "string",
      "title": "An identifier for a target",
      "description": "A target key has two parts, a package and a name. They are separated by a colon.",
      "pattern": "^(?:\\w+:)?\\w+|\\$default$"
    },
    "builderKey": {
      "type": "string",
      "title": "An identifier for a builder",
      "description": "To construct a key, you join the package name and the builder name with a colon.",
      "pattern": "^(?:\\w*:)?\\w+$"
    },
    "runsBefore": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/builderKey"
      }
    }
  },
  "description": "Configuration for Dart's build system",
  "title": "build.yaml files"
}
