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

Allow schema to be omitted when using default root op names #364

Conversation

dackroyd
Copy link
Contributor

Fixes #304

graphql_test.go Outdated
@@ -2512,15 +2742,19 @@ func (r *inputResolver) Nullable(args struct{ Value *int32 }) *int32 {
return args.Value
}

func (r *inputResolver) List(args struct{ Value []*struct{ V int32 } }) []int32 {
func (r *inputResolver) List(args struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crept in, will revert these unrelated changes

@@ -362,7 +362,8 @@ func (b *execBuilder) makeFieldExec(typeName string, f *schema.Field, m reflect.
var out reflect.Type
if methodIndex != -1 {
out = m.Type.Out(0)
if typeName == "Subscription" && out.Kind() == reflect.Chan {
sub, ok := b.schema.EntryPoints["subscription"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an existing bug which prevents the subscription root op having a type named anything other than Subscription. Had to fix it here to verify correct behaviour for custom type names, but can split that work if desired

@dackroyd dackroyd force-pushed the populate-default-entrypoints-without-explicit-schema branch from 10ae3b8 to 6c0f0e3 Compare October 30, 2019 11:46
@dackroyd
Copy link
Contributor Author

Looking through open PRs on the repo, I notice that this has been raised previously under #126 back in 2017, but never merged. The codebase has drifted quite a lot since then, so it has picked up a few conflicts

}
return nil
}
if t.Kind() != "OBJECT" {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if _, ok := t.(*schema.Object); !ok {

^ could be a better way of checking this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are equivalent, IMHO

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.

Populating entry points without explicity schema{}
2 participants