Skip to content

Add federation directives if not defined #702

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

smyrick
Copy link
Contributor

@smyrick smyrick commented May 11, 2020

📝 Description

This has now been changed to add all the federation directives if they are not defined.

Since the extends directive is always used in federation on the Query object we should always have the directive definition in the schema. However it may already be added if the generated schema uses it, so only add the definition if it is not yet defined

The schema we generate today will still work on the server, it just fails if you happen to run through the generated SDL through the Apollo CLI or Gateway.

🔗 Related Issues

N\A

Since the extends directive is always used in federation on the Query object we should always have the directive definition in the schema. However it may already be added if the generated schema uses it, so only add the definition if it is not yet defined
@smyrick smyrick added type: bug Something isn't working changes: patch Changes require a patch version labels May 11, 2020
) on FIELD_DEFINITION | ENUM_VALUE

"Marks target object as extending part of the federated schema"
directive @extends on OBJECT | INTERFACE
Copy link
Contributor Author

@smyrick smyrick May 11, 2020

Choose a reason for hiding this comment

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

Before my fix, when I set includeDirectives = true below, this definition was not there

@dariuszkuc dariuszkuc merged commit e4a4aac into ExpediaGroup:master May 12, 2020
@smyrick smyrick changed the title Add extends directive if not defined Add federation directives if not defined May 12, 2020
@smyrick smyrick deleted the include-extends-directive-definition branch May 12, 2020 20:03
@smyrick smyrick added this to the 3.0.0 milestone May 14, 2020
dariuszkuc pushed a commit to dariuszkuc/graphql-kotlin that referenced this pull request Aug 5, 2022
* Add extends directive if not defined

Since the extends directive is always used in federation on the Query object we should always have the directive definition in the schema. However it may already be added if the generated schema uses it, so only add the definition if it is not yet defined

* Add all directive definitions even if not used

Co-authored-by: Shane Myrick <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: patch Changes require a patch version type: bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants