{
  "$defs": {
    "file": {
      "oneOf": [
        {
          "description": "This object or string represents the file format",
          "type": "string"
        },
        {
          "description": "This object or string represents the file format",
          "type": "null"
        },
        {
          "$ref": "#/$defs/fileFormat",
          "description": "This object or string represents the file format"
        }
      ]
    },
    "fileFormat": {
      "description": "This object represents a file format",
      "type": "object",
      "properties": {
        "name": {
          "description": "Name of block file",
          "type": "string"
        },
        "template": {
          "description": "Path to file template",
          "type": "string"
        }
      },
      "required": ["name"]
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "https://json.schemastore.org/lego.json",
  "properties": {
    "blocks": {
      "description": "An array of your app's blocks.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "description": "The name of the block type",
            "type": "string"
          },
          "path": {
            "description": "Path relative to root where the block will be stored",
            "type": "string"
          },
          "isFile": {
            "description": "Is this a file? or a folder? False by default.",
            "type": "boolean"
          },
          "files": {
            "description": "Files making up the block",
            "type": "array",
            "items": {
              "$ref": "#/$defs/file"
            }
          },
          "file": {
            "$ref": "#/$defs/file"
          }
        },
        "required": ["type", "path"]
      }
    },
    "fileFormats": {
      "description": "An object mapping file objects to strings",
      "type": "object",
      "patternProperties": {
        ".*": {
          "$ref": "#/$defs/fileFormat"
        }
      }
    }
  },
  "required": ["blocks"],
  "type": "object"
}