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

Conversation

phryneas
Copy link
Member

@phryneas phryneas commented Sep 20, 2024

Following up on our discussion from last week.

Copy link
Contributor

github-actions bot commented Sep 20, 2024

You can download the latest build of the extension for this PR here:
vscode-apollo-0.0.0-build-1729249832.pr-216.commit-f344a9b.zip.

To install the extension, download the file, unzip it and install it in VS Code by selecting "Install from VSIX..." in the Extensions view.

Alternatively, run

code --install-extension vscode-apollo-0.0.0-build-1729249832.pr-216.commit-f344a9b.vsix --force

from the command line.

For older builds, please see the edit history of this comment.

package.json Outdated
Comment on lines 263 to 264
"_url": "https://github.com/apollographql/router-template/raw/main/.apollo/router_config_schema.json",
"url": "./schemas/router_config_schema.json"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I should link to the schema on GitHub or a local copy here. Any thoughts @dylan-apollo?

Suggested change
"_url": "https://github.com/apollographql/router-template/raw/main/.apollo/router_config_schema.json",
"url": "./schemas/router_config_schema.json"
"url": "https://github.com/apollographql/router-template/raw/main/.apollo/router_config_schema.json"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do a local schema, you should also set up Renovate to regenerate it when new router releases come out—which would mean releasing a new version of the extension every week or two with the latest.

Or, I suppose, if we're keeping it up to date, we could also point the URL to this repo instead of router-template?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll already have releases trickling in other places - Apollo Client release will trigger Apollo Devtools release, which will long-term trigger a release of the VSCode Devtools (or at least a PR).

I'm not too keep on doing that repeatedly with even more upstream sources, so I'd honestly rather point at another repo that is kept kinda up-to-date.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Configuration",
"description": "The configuration for the router.\n\nCan be created through `serde::Deserialize` from various formats, or inline in Rust code with `serde_json::json!` and `serde_json::from_value`.",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description is a bit unfortunate as it shows up in the editor:

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is something we should run by the router team. The point of this schema is to get editor support, so we should be updating our internal docs to be more useful for external consumers

@dylan-apollo
Copy link
Member

Something I didn't consider, that we should test, is how this works with unstable router features. We have new config for Router 2.0, I wonder if that shows up as an error, with this change 😐

@phryneas
Copy link
Member Author

phryneas commented Sep 20, 2024

Something I didn't consider, that we should test, is how this works with unstable router features. We have new config for Router 2.0, I wonder if that shows up as an error, with this change 😐

Two strategies come to mind:

  • Have some "config-version" key in there and both versions in the schema as alternative schemas (maybe this could even reference two different urls? I'm not that deep in json schemas yet)
  • We add another config for an apollo-router-2.yaml or similar.

@dylan-apollo
Copy link
Member

@jerelmiller can we keep/merge the supergraph schema one (which pretty much never changes and should be safe) and just take out the Router config stuff for now? I don't think I'll have time to fix the red squigglies on connectors features before we want this released.

@phryneas phryneas changed the title add json schemas for apollo-router.yaml and supergraph.yaml add json schemas for supergraph.yaml Oct 18, 2024
@phryneas
Copy link
Member Author

@dylan-apollo I've reduced the scope to supergraph.yaml for now - should I get this in?

Copy link
Member

@dylan-apollo dylan-apollo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it, thanks!!

@phryneas phryneas merged commit 1add31e into main Oct 22, 2024
10 checks passed
@phryneas phryneas deleted the pr/router-config-schema branch October 22, 2024 07:44
@github-actions github-actions bot mentioned this pull request Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants