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

@interfaceObject is not supported. #2816

Closed
wangmir opened this issue Oct 1, 2023 · 4 comments
Closed

@interfaceObject is not supported. #2816

wangmir opened this issue Oct 1, 2023 · 4 comments

Comments

@wangmir
Copy link
Contributor

wangmir commented Oct 1, 2023

What happened?

interfaceObject is apollo federation directive. But, when I try to use it, it falsly generate directive handler at generated file.

it generates InterfaceObject at DirectiveRoot on generated exec.go

type DirectiveRoot struct {
	ComposeDirective func(ctx context.Context, obj interface{}, next graphql.Resolver, name string) (res interface{}, err error)
	InterfaceObject  func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error)
}

What did you expect?

Seamlessly handling without adding new directive handler.

I think it's because interfaceObject is missing from

if f.Version == 2 {
cfg.Directives["shareable"] = config.DirectiveConfig{SkipRuntime: true}
cfg.Directives["link"] = config.DirectiveConfig{SkipRuntime: true}
cfg.Directives["tag"] = config.DirectiveConfig{SkipRuntime: true}
cfg.Directives["override"] = config.DirectiveConfig{SkipRuntime: true}
cfg.Directives["inaccessible"] = config.DirectiveConfig{SkipRuntime: true}
cfg.Directives["authenticated"] = config.DirectiveConfig{SkipRuntime: true}
cfg.Directives["requiresScopes"] = config.DirectiveConfig{SkipRuntime: true}
}

Minimal graphql.schema and models to reproduce

just adding interfaceObject on existing test data of federation2.

extend schema
  @link(url: "https://specs.apollo.dev/federation/v2.3",
        import: ["@key", "@shareable", "@provides", "@external", "@tag", "@extends", "@override", "@inaccessible", "@interfaceObject"])

schema {
    query: CustomQuery
}

type Hello @key(fields:"name", resolvable: false) @interfaceObject {
  name: String!
}

type World @key(fields: "foo bar", resolvable: false) {
    foo: String!
    bar: Int!
}

extend type ExternalExtension @key(fields: "  upc    ") {
    upc: String!
    reviews: [Hello]
}

type CustomQuery {
  hello: Hello!
}

versions

  • go run github.com/99designs/gqlgen version?
    0.17.38
  • go version?
    1.20.4
@wangmir
Copy link
Contributor Author

wangmir commented Oct 4, 2023

It seems this PR (#2699) is the fix, but it's not getting in. @StevenACoffman can we add this?

@StevenACoffman
Copy link
Collaborator

The original author hasn't gotten it to pass both tests and linting and resolved the merge conflicts. Would you make a new PR that does?

@wangmir
Copy link
Contributor Author

wangmir commented Oct 4, 2023

@StevenACoffman Ok, I'll try then.

@StevenACoffman
Copy link
Collaborator

Fixed in #2821

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

No branches or pull requests

2 participants