Skip to content

Conversation

@gnawf
Copy link
Contributor

@gnawf gnawf commented Jul 17, 2023

No description provided.

GraphQLDirective protoType = schema.getDirective(directive.getName());
if (protoType != null) {
GraphQLDirective newDirective = protoType.transform(builder -> buildArguments(builder, codeRegistry, protoType, directive, variables, graphQLContext, locale));
directiveMap.put(newDirective.getName(), newDirective);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously this would just replace the last directive instance. Now it accumulates the values for repeated directives.

public DirectivesResolver() {
}

public Map<String, GraphQLDirective> resolveDirectives(List<Directive> directives, GraphQLSchema schema, Map<String, Object> variables, GraphQLContext graphQLContext, Locale locale) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if we should just return a List<GraphQLDirecitve>since we don't even use the map result. It's immediately discarded as we call Map.values()

}

public static <T> List<T> flatList(List<List<T>> listLists) {
public static <T> List<T> flatList(Collection<List<T>> listLists) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed as Map.values() returns a Collection (Maps aren't ordered).

then:
appliedDirectivesByName.keySet() == ["rep"] as Set
appliedDirectivesByName["rep"].size() == 2
// Groovy is a pathway to many abilities some consider to be unnatural
Copy link
Member

Choose a reason for hiding this comment

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

Groovy is a pathway to many abilities some consider to be unnatural
Lol

Copy link
Contributor

Choose a reason for hiding this comment

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

My favourite is groovy will ignore all 'private' modifier. I am not selfish. I can even share other's private with you.

then:
appliedDirectivesByName.keySet() == ["rep"] as Set
appliedDirectivesByName["rep"].size() == 2
// Groovy is a pathway to many abilities some consider to be unnatural
Copy link
Member

Choose a reason for hiding this comment

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

Lol you put this in to verify that I read all the way to the end, right?

@dondonz dondonz added this pull request to the merge queue Jul 18, 2023
Merged via the queue into graphql-java:master with commit 3d80faf Jul 18, 2023
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.

4 participants