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

ExportDirective with type argument fails to prepend @ to directive name #7799

Closed
willgittoes opened this issue Dec 2, 2024 · 5 comments · Fixed by #7812
Closed

ExportDirective with type argument fails to prepend @ to directive name #7799

willgittoes opened this issue Dec 2, 2024 · 5 comments · Fixed by #7812
Labels
Area: Apollo Federation Issue is related to Apollo Federation 🌶️ hot chocolate
Milestone

Comments

@willgittoes
Copy link

Product

Hot Chocolate

Version

14.2.0-p.7

Link to minimal reproduction

https://github.com/ChilliCream/hotchocolate-examples/pull/69/files

Steps to reproduce

  1. Check out branch in MR
  2. Run once, service will save schema file when it starts

Bug is:

  1. Use ExportDirective with a type parameter (rather than giving a string)
  2. The created composeDirective does not prefix the directive to compose with @

What is expected?

The created composeDirective prefixes the directive to compose with @

What is actually happening?

The created composeDirective does not prefix the directive to compose with @

Relevant log output

Additional context

Workaround is to pass a string rather than use a type param

@willgittoes
Copy link
Author

Bonus bug/feature request:

RemoveUnreachableTypes removes directives that are referenced in composeDirective unless they're also used somewhere else, leading to a schema error when you try to compose the schema in Apollo. RemoveUnreachableTypes should consider being referenced in composeDirective as being reachable.

@willgittoes
Copy link
Author

Double-bonus bug/feature request:

DirectiveTypeInterceptor also discards directives in the same way, marking them as being unused.

@michaelstaib
Copy link
Member

We have dropped support for @export with version 14.

@michaelstaib
Copy link
Member

michaelstaib commented Dec 3, 2024

Is your question about exporting directives in apollo federation?

@michaelstaib michaelstaib reopened this Dec 3, 2024
@michaelstaib michaelstaib added the Area: Apollo Federation Issue is related to Apollo Federation label Dec 3, 2024
@michaelstaib michaelstaib added this to the HC-14.4.0 milestone Dec 3, 2024
@willgittoes
Copy link
Author

Yes, sorry. I don't mean a directive called @export, I mean this:

        graphQlService
            .AddApolloFederation(FederationVersion.Federation26)
            .AddDirectiveType<MyCoolDirective>()
            .AddLink(
                "https://example.com/customDirectives.graphql/v1.1",
                new[] { "@myCool" }
            )
            // .ExportDirective<MyCoolDirective>() // Doesn't work
            .ExportDirective("@myCool")

I made a reproduction in https://github.com/ChilliCream/hotchocolate-examples/pull/69/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Apollo Federation Issue is related to Apollo Federation 🌶️ hot chocolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants