-
Notifications
You must be signed in to change notification settings - Fork 843
[WIP] Working draft version of validator
and a couple of validation rules
#71
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Ported a portion of tests to verify validator is working at some level. - Updated `visitor` implementation. - Proved to be tricky because current implementation allows user to edit the tree in-memory - for e.g. `printer` reduces the `ast.Node` into a string - Need thorough clean up but working at the moment. - Rules have to exists under `graphql`, due it being tightly-coupled. - Total number of rules: 22 - Currently planned to write all rules in `rules.go`. - Else, split it up to many files - But tests are filed under `rules/` folder. - TODO: - Complete port of tests for `ArgumentsOfCorrectTypeRule` and `KnownTypeNamesRule` - Implement other validation rules. - Should be relatively straight forward since now we have examples on how to implement it.
- Add an empty package
- All tests passed - Update `ParseLiteral` funcs for built-in `scalars` to return nil for incorrect types. - Will be used by `validator` to raise errors arg values of incorrect types ``` ok github.com/graphql-go/graphql 0.195s ? github.com/graphql-go/graphql/examples/hello-world [no test files] ? github.com/graphql-go/graphql/examples/http [no test files] ? github.com/graphql-go/graphql/gqlerrors [no test files] ? github.com/graphql-go/graphql/language/ast [no test files] ? github.com/graphql-go/graphql/language/kinds [no test files] ok github.com/graphql-go/graphql/language/lexer 0.012s ? github.com/graphql-go/graphql/language/location [no test files] ok github.com/graphql-go/graphql/language/parser 0.031s ok github.com/graphql-go/graphql/language/printer 0.081s ? github.com/graphql-go/graphql/language/source [no test files] ok github.com/graphql-go/graphql/language/visitor 0.014s ok github.com/graphql-go/graphql/rules 0.080s ok github.com/graphql-go/graphql/testutil 0.016s ```
- Fixed failing `abstract_test.go`
Merge latest changes from HEAD
* master: Add go vet to travis builds Fix go vet errors
Awesome! 🌟 ... thanks for working on the Pretty need, I've being trying-out the lib in a small demo project and sometimes my graphql operations are syntactically correct but semantically incorrect, not valid one against my previously defined schema, this is def going to give feedback about invalid operations against schemas. |
…nRule` and tested
Merge latest changes from HEAD
* sogko/master: re-export name & description Remove Get prefix from Type methods gqlerrors.GQLFormattedErrorSlice -> gqlerrors.FormattedErrors graphql.GQLFRParams -> graphql.ResolveParams graphql.FieldConfig -> graphql.Field graphql.FieldConfigMap -> graphql.Fields graphql.Graphql -> graphql.Do Fix declared but not used errors
- Go's default coverage tool won't cover tests in a different folder. - Need better organization for tests in root folder
- Re-checked the number of tests against `graphql-js` to ensure that all tests have been ported
Completed working version of the
/cc @chris-ramon |
2 tasks
chris-ramon
added a commit
that referenced
this pull request
Nov 23, 2015
[WIP] Working draft version of `validator` and a couple of `validation rules`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related #67
Status: Ready for merge
ArgumentsOfCorrectType.js
DefaultValuesOfCorrectType.js
FieldsOnCorrectType.js
FragmentsOnCompositeTypes.js
KnownArgumentNames.js
KnownDirectives.js
KnownFragmentNames.js
KnownTypeNames.js
LoneAnonymousOperation.js
NoFragmentCycles.js
NoUndefinedVariables.js
NoUnusedFragments.js
NoUnusedVariables.js
OverlappingFieldsCanBeMerged.js
PossibleFragmentSpreads.js
ProvidedNonNullArguments.js
ScalarLeafs.js
UniqueArgumentNames.js
UniqueFragmentNames.js
UniqueOperationNames.js
VariablesAreInputTypes.js
VariablesInAllowedPosition.js
ArgumentsOfCorrectType.js
DefaultValuesOfCorrectType.js
FieldsOnCorrectType.js
FragmentsOnCompositeTypes.js
KnownArgumentNames.js
KnownDirectives.js
KnownFragmentNames.js
KnownTypeNames.js
LoneAnonymousOperation.js
NoFragmentCycles.js
NoUndefinedVariables.js
NoUnusedFragments.js
NoUnusedVariables.js
OverlappingFieldsCanBeMerged.js
PossibleFragmentSpreads.js
ProvidedNonNullArguments.js
ScalarLeafs.js
UniqueArgumentNames.js
UniqueFragmentNames.js
UniqueOperationNames.js
VariablesAreInputTypes.js
VariablesInAllowedPosition.js
Notes
visitor
implementation.printer
reduces theast.Node
into a stringgraphql
, due it being tightly-coupled.rules.go
.rules/
folder.