-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Schema Usage support #2548
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
Schema Usage support #2548
Conversation
| } | ||
|
|
||
|
|
||
| private final static Set<String> SPECIFIED_DIRECTIVES = ImmutableSet.of( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have the same methods/logic already in DirectiveInfo I believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
| @Internal | ||
| static class Builder { | ||
| Map<String, Integer> fieldReferenceCounts = new HashMap<>(); | ||
| Map<String, Integer> inputFieldReferenceCounts = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend ImmutableMaps.Builder here, which preserve the order and are immutable OR our beloved LinkedHashMap or a comment why the order is never interesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImmutableMap.Builder does not support compute like behavior. I want to accumulate values (counts) against type names.
private BiFunction<String, Integer, Integer> incCount() {
return (k, v) -> v == null ? 1 : v + 1;
}
builder.fieldReferenceCounts.compute(fieldType.getName(), incCount());
With map builder it has only PUT and no read capability for past values
So I cant use it. I do use it on getters however. I will improve it to create these once and once only
A PR on getting schema usage stats and "reference" ability