{
  "$id": "https://deno.land/x/deno/cli/schemas/module-graph.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "module": {
      "type": "object",
      "required": [
        "specifier",
        "dependencies"
      ],
      "properties": {
        "specifier": {
          "type": "string",
          "description": "The fully qualified module specifier (URL) for the module."
        },
        "dependencies": {
          "type": "array",
          "description": "An array of dependencies of the module.",
          "items": {
            "$ref": "#/$defs/dependency"
          }
        },
        "typeDependency": {
          "$ref": "#/$defs/dependency",
          "description": "The type dependency for the module. This is set when the file contains a reference to its types or the module was supplied with a types header."
        },
        "size": {
          "type": "integer",
          "description": "The size of the module on disk in bytes."
        },
        "mediaType": {
          "type": "string",
          "description": "How the file is treated within Deno.  All the possible media types that Deno considers are listed here, but in practice, several of them would never appear in a module graph.",
          "enum": [
            "JavaScript",
            "TypeScript",
            "JSX",
            "TSX",
            "Dts",
            "Json",
            "Wasm",
            "TsBuildInfo",
            "SourceMap",
            "Unknown"
          ]
        },
        "local": {
          "type": "string",
          "description": "The path to the local file. For local modules this will be the local file path, for remote modules and data URLs, this would be the path to the file in the Deno cache."
        },
        "checksum": {
          "type": "string",
          "description": "The checksum of the local source file. This can be used to validate if the current on disk version matches the version described here."
        },
        "error": {
          "type": "string",
          "description": "If when resolving the module, Deno encountered an error and the module is unavailable, the text of that error will be indicated here."
        }
      }
    },
    "dependency": {
      "type": "object",
      "required": [
        "specifier"
      ],
      "properties": {
        "specifier": {
          "type": "string",
          "description": "The specifier provided from within the module."
        },
        "isDynamic": {
          "type": "boolean",
          "description": "A flag that indicates if the import is dynamically imported. A dynamic import may not be fully resolved until it is accessed at runtime."
        },
        "code": {
          "type": "string",
          "description": "The fully qualified module specifier (URL) for the code dependency."
        },
        "type": {
          "type": "string",
          "description": "The fully qualified module specifier (URL) for the type only dependency."
        }
      }
    }
  },
  "title": "Deno Dependency Graph Schema",
  "description": "A JSON representation of a Deno module dependency graph.",
  "type": "object",
  "required": [
    "root",
    "modules",
    "size"
  ],
  "properties": {
    "root": {
      "default": "",
      "description": "The root specifier for the graph.",
      "examples": [
        "https://deno.land/x/mod.ts"
      ],
      "type": "string"
    },
    "modules": {
      "default": [],
      "description": "The modules that are part of the graph.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/module"
      }
    },
    "size": {
      "type": "integer",
      "description": "The total size of all the unique dependencies in the graph in bytes.",
      "default": 0
    }
  }
}
