Skip to content

fix: directives with arguments should be created per declaration #287

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
merged 1 commit into from
Jul 31, 2019

Conversation

dariuszkuc
Copy link
Collaborator

Directive definitions should only be added to the schema once - while building the schema we are caching the directive definitions and add them after processing all the objects. Our current logic relies on this cache to not-rebuild the directives per each one of its declarations. Directives can have arguments which means that we have to rebuild the directive definition if they accept any arguments.

Directive definitions should only be added to the schema once - while building the schema we are caching the directive definitions and add them after processing all the objects. Our current logic relies on this cache to not-rebuild the directives per each one of its declarations. Directives can have arguments which means that we have to rebuild the directive definition if they accept any arguments.

internal class SchemaGeneratorState(supportedPackages: List<String>) {
val cache = TypesCache(supportedPackages)
val additionalTypes = mutableSetOf<GraphQLType>()
val directives = mutableSetOf<GraphQLDirective>()
val directives = ConcurrentHashMap<String, GraphQLDirective>()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated to ConcurrentHashMap instead of just simple HashMap as by default maven surefire plugin runs test in parallel which lead to some concurrency issues

@smyrick smyrick added changes: patch Changes require a patch version type: bug Something isn't working labels Jul 31, 2019
@smyrick smyrick merged commit d31ae62 into ExpediaGroup:master Jul 31, 2019
@dariuszkuc dariuszkuc deleted the directives_with_args branch July 31, 2019 22:18
smyrick pushed a commit to smyrick/graphql-kotlin that referenced this pull request Sep 11, 2019
…ediaGroup#287)

Directive definitions should only be added to the schema once - while building the schema we are caching the directive definitions and add them after processing all the objects. Our current logic relies on this cache to not-rebuild the directives per each one of its declarations. Directives can have arguments which means that we have to rebuild the directive definition if they accept any arguments.
dariuszkuc added a commit to dariuszkuc/graphql-kotlin that referenced this pull request Aug 5, 2022
…ediaGroup#287)

Directive definitions should only be added to the schema once - while building the schema we are caching the directive definitions and add them after processing all the objects. Our current logic relies on this cache to not-rebuild the directives per each one of its declarations. Directives can have arguments which means that we have to rebuild the directive definition if they accept any arguments.
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