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

Port the rest of the types package tests #12

Merged
merged 18 commits into from
Oct 2, 2015
Merged

Conversation

sogko
Copy link
Member

@sogko sogko commented Sep 26, 2015

Details

Currently the types branch includes some fixes to bugs where introspection does not return the right output when queried (Some of the fixes I've yet to commit to the branch yet).

This PR would not be ready for merge until all tests in the task lists are completed and all tests have passed.

Task list

  • scalars_serialization tests
  • definition tests
  • enumType tests
  • introspection tests
  • validation tests
  • code cleanup

Test

$ go build && go test ./...
ok      github.com/chris-ramon/graphql-go   0.014s
?       github.com/chris-ramon/graphql-go/errors    [no test files]
ok      github.com/chris-ramon/graphql-go/executor  0.110s
?       github.com/chris-ramon/graphql-go/language/ast  [no test files]
?       github.com/chris-ramon/graphql-go/language/kinds    [no test files]
ok      github.com/chris-ramon/graphql-go/language/lexer    0.011s
?       github.com/chris-ramon/graphql-go/language/location [no test files]
ok      github.com/chris-ramon/graphql-go/language/parser   0.039s
ok      github.com/chris-ramon/graphql-go/language/printer  0.055s
?       github.com/chris-ramon/graphql-go/language/source   [no test files]
ok      github.com/chris-ramon/graphql-go/language/visitor  0.017s
ok      github.com/chris-ramon/graphql-go/testutil  0.035s
ok      github.com/chris-ramon/graphql-go/types 0.098s
?       github.com/chris-ramon/graphql-go/validator [no test files]

Merge latest changes from HEAD
Merge latest changes from HEAD
Merge latest changes from HEAD
…a struct.

Try to match the given field name with the struct field name first, before matching with json tag
…utomatically resolve its fields

- Implement resolve functions to some introspection field configs.
- The rest will be filled in when the tests are ported
  - Ported from `type/__tests__/enumType.js`
  - Some tests are marked as skipped, pending `validator` implementation
  - Change `GraphQLEnumValueConfigMap` to `map[string]*GraphQLEnumValueConfig`.
    Consistent with `GraphQLFieldConfigMap` and others
  - Ported from `type/__tests__/validation.js`
  - Some tests are marked as skipped, pending `validator` implementation
  - Exposed `GetError() error` to GraphQLType interface so that errors can be detected during construction of schema
    - This was an alternative to throwing a panic.
@sogko
Copy link
Member Author

sogko commented Sep 30, 2015

Completed porting tests for types. Adding tests cases did exposed more missing implementation and bugs.

Notes

  • This might conflict with PR Renames package types to gqltypes #16, a lot of changes were made to types package directory.
  • TODO in a separate PR: Consolidate a couple of common utility/helpers e.g executor.isNullish()
  • Added a test util to check if a map[string]interface{} is a subset of another map (testutil.ContainSubset()). Needed for introspection_test.go
  • Added a test util to check if a []interface{} is a subset of another slice (testutil.ContainSubsetSlice()). Needed for introspection_test.go

/cc @chris-ramon

- `react-relay` throws an error if `errors` key exist but nil
- Checked `express-graphql` implementation, same behaviour (omit if empty)
sogko added a commit that referenced this pull request Oct 2, 2015
Port the rest of the `types` package tests
@sogko sogko merged commit 9e255b8 into graphql-go:master Oct 2, 2015
@chris-ramon
Copy link
Member

Thanks a lot! for ur work on this one 🌟 finally landed 😄

@sogko
Copy link
Member Author

sogko commented Oct 2, 2015

Haha no problem, was glad to contribute 👍🏻
I just wanted to quickly see a working implementation of graphql for golang as quickly as possible (I was getting kind of jealous that ruby, python, scala etc already have working libraries for graphql)

By the way, I've got a live demo of graphql-go, using relay, graphiql and all that goodness, up and running at http://bit.ly/try-graphql-go
The source is available at https://github.com/sogko/golang-graphql-playground

Cheers!

@chris-ramon
Copy link
Member

That is so awesome! 👍 great example! 🚀 , def will take a look closely.

@sogko sogko deleted the fork/types branch October 29, 2015 02:15
lenaten pushed a commit to lenaten/graphql-go that referenced this pull request Nov 2, 2015
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.

2 participants