-
Notifications
You must be signed in to change notification settings - Fork 112
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
Align support for multiple operation-files and multiple schema-files #137
Conversation
Multiple schema-files are now supported as of #134, but the support was a bit different from how we did multiple operation-files. Before anyone starts to depend on the ways the syntaxes differ, let's just make them the same. Since it's easy, I also added support for having just a single operations-file. Test plan: make check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you don't support **
anymore? (Or does Glob do it by default these days?) That's fine, I think, but you'll probably want to update the doc example that has one.
} | ||
|
||
for _, m := range matches { | ||
if schemas.Has(m) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can probably get rid of the Has
function too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! You may want to cc the original patch author so they know of the semantic change around **
.
cc @hsblhsn if you wanted to take a look! If it's an issue we could move to using the fancier globbing for both. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just my thoughts. Don't make it hard to debug.
filename, _ := graphqlError.Extensions["file"].(string) | ||
return nil, errorf(nil, "invalid schema file %v: %v", filename, graphqlError) | ||
return nil, errorf(nil, "invalid schema: %v", graphqlError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing file name from error message will make it really hard to find issues in schema or operation files. Since we still do not have strong IDE support for graphql SDL files.
WDYT?
testdata/errors/InvalidSchema.schema.graphql:4: invalid schema file testdata/errors/InvalidSchema.schema.graphql: Expected :, found } | ||
testdata/errors/InvalidSchema.schema.graphql:4: invalid schema: Expected :, found } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finding the exact issue will be tough just by seeing the new error message. Previous message was better IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the filename is still there, just in a different place:
testdata/errors/InvalidSchema.schema.graphql:4: invalid schema: Expected :, found }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opps, sorry I missed it. LGTM now!
Multiple schema-files are now supported as of #134, but the support was
a bit different from how we did multiple operation-files. Before anyone
starts to depend on the ways the syntaxes differ, let's just make them
the same. Since it's easy, I also added support for having just a
single operations-file.
I also realized while writing this that the type-change is technically
breaking (if you call from Go), so documented it as such. I think
this is unlikely to affect many people.
Test plan: make check