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

Support multiple schema files with localSchemaFile #1500

Merged
merged 7 commits into from
Sep 12, 2019

Conversation

JakeDawkins
Copy link
Contributor

@JakeDawkins JakeDawkins commented Sep 5, 2019

Resolves #1483

What

The purpose of this PR is to officially support multiple schema files through the localSchemaFile config option and CLI flag for the client and service commands.

Why

Until VSCode 1.10.0 (and accompanying CLI release), I've been recommending people use the client.includes option to allow for multiple schema files when needed. Since client includes now is treated as a client schema for the purpose of autocompleting client fields (#1433) this no longer works.

How

This PR overloads the existing localSchemaFile option, allowing for a list of filepaths (in the config file) or multiple uses of the --localSchemaFile flag (in the CLI).

The schema loader will go through the same process it used to in order to load a schema from a file, with a couple modifications.

  • load each file's contents
    • if the file is a json file, convert it to SDL
  • return the schema SDL
  • concatenate all collected SDLs
  • build schema from concatenated SDLs

Questions

  • will this work with type extensions?
    • if not, we could use extendSchema instead to progressively build the schema
  • are there other benefits to using extendSchema rather than concatenating SDL?
  • should we allow globs here rather than just filepaths?
    • this would add a little complexity since we'd have to handle a single glob, multiple globs, as well as a mix of globs/filepaths in the list
    • How could we distinguish between a glob and a filePath?

TODO:

  • Update CHANGELOG.md* with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

*Make sure changelog entries note which project(s) has been affected. See older entries for examples on what this looks like.

@JakeDawkins JakeDawkins marked this pull request as ready for review September 11, 2019 20:22
@JakeDawkins JakeDawkins force-pushed the jake/multiple-localSchemaFiles branch 2 times, most recently from 7bb1869 to a3c3880 Compare September 12, 2019 14:55
@JakeDawkins JakeDawkins merged commit 7e273f7 into master Sep 12, 2019
@JakeDawkins JakeDawkins deleted the jake/multiple-localSchemaFiles branch September 12, 2019 17:19
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.

VSCode: Multiple local schema files validation problem in 1.10.0
1 participant