Open kitten opened 2 months ago
Latest commit: fd4e02f71e3c10232f47184c33e636eae5a34bc4
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Summary
This has been requested multiple times now, and I thought I'd take a stab at implementing it.
When applied, this PR allows the
schema
option to accept arrays of paths, arrays of globs, and globs. This means that multiple SDL files can now be merged into a single one with thegenerate-schema
command and that the SDL loader will discover multiple files.This has been implemented using
ts.sys.readDirectory
, which should already support this pretty comprehensively.When multiple
.json
files are discovered, an error is thrown.The risk of errors increases by a lot when we accept multiple SDL files, that have potentially not been processed by other tools. This is because they might have been hand-written and not validated by any other tool. I haven't figured out yet what to do about this, especially since GraphQLSP/TSServer cannot output global errors. I'm currently thinking, we can only merge this if we have a strategy for surfacing global errors in
graphqlsp
.Set of changes
loadFromSDL
config signature has changed to accept arootPath
loadFromSDL
now usests.sys.readDirectory
to discover multiple schema filesloadFromSDL
is used with a single JSON file nothing changes, otherwise, if multiple files are discovered and one is a JSON file, an error is throwngenerate-schema
command now accepts multiple input strings