{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "SupergraphConfig",
  "description": "The configuration for a single supergraph composed of multiple subgraphs.",
  "type": "object",
  "required": ["subgraphs"],
  "properties": {
    "federation_version": {
      "anyOf": [
        {
          "$ref": "#/definitions/FederationVersion"
        },
        {
          "type": "null"
        }
      ]
    },
    "subgraphs": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/SubgraphConfig"
      }
    }
  },
  "definitions": {
    "FederationVersion": {
      "pattern": "^(1|2|=2\\.\\d+\\.\\d+.*)$"
    },
    "SchemaSource": {
      "description": "Options for getting SDL: the graph registry, a file, or an introspection URL.\n\nNOTE: Introspection strips all comments and directives from the SDL.",
      "anyOf": [
        {
          "type": "object",
          "required": ["file"],
          "properties": {
            "file": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": ["subgraph_url"],
          "properties": {
            "introspection_headers": {
              "type": ["object", "null"],
              "additionalProperties": {
                "type": "string"
              }
            },
            "subgraph_url": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        {
          "type": "object",
          "required": ["graphref", "subgraph"],
          "properties": {
            "graphref": {
              "type": "string"
            },
            "subgraph": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": ["sdl"],
          "properties": {
            "sdl": {
              "type": "string"
            }
          }
        }
      ]
    },
    "SubgraphConfig": {
      "description": "Config for a single [subgraph](https://www.apollographql.com/docs/federation/subgraphs/)",
      "type": "object",
      "required": ["schema"],
      "properties": {
        "routing_url": {
          "description": "The routing URL for the subgraph. This will appear in supergraph SDL and instructs the graph router to send all requests for this subgraph to this URL.",
          "type": ["string", "null"]
        },
        "schema": {
          "description": "The location of the subgraph's SDL",
          "allOf": [
            {
              "$ref": "#/definitions/SchemaSource"
            }
          ]
        }
      }
    }
  }
}
