Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add json schemas for supergraph.yaml #216

Merged
merged 5 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/three-teachers-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vscode-apollo": patch
---

Add JSON schema for `supergraph.yaml`.
2 changes: 1 addition & 1 deletion .github/workflows/E2E.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
version: ["1.90.0", "stable", "insiders"]
steps:
- run: sudo apt update && sudo apt install -y libasound2t64 libgbm1 libgtk-3-0 libnss3 xvfb expect
- run: sudo apt update && sudo apt install -y libasound2 libgbm1 libgtk-3-0 libnss3 xvfb expect
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@
{
"fileMatch": "apollo.config.yaml",
"url": "./schemas/apollo.config.schema.json"
},
{
"fileMatch": "supergraph.yaml",
"url": "./schemas/supergraph_config_schema.json"
}
],
"commands": [
Expand Down
119 changes: 119 additions & 0 deletions schemas/supergraph_config_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"$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"
}
]
}
}
}
}
}