| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Thanks for the PR @dfa1. In general we prefer not to open up ExecutionStrategy more or encourage people to derive from it. Can we instead define an abstract Factory method or so that can be provided via config, similar to ValueUnboxer? thx |
Sorry, something went wrong.
|
@andimarek sounds good... I have several concrete classes deriving from ExecutionStrategy (and feels wrong actually, because I'm tapping into the internals). What could be a good name? MapFactory? |
Sorry, something went wrong.
Let's go with ResponseMapFactory for now. |
Sorry, something went wrong.
|
@andimarek done... please have another look and feel free to suggest better javadoc ;) |
Sorry, something went wrong.
|
@andimarek @bbakerman I just rebased to fix some conflicts, do you like the current state? do you expect more javadoc? |
Sorry, something went wrong.
| */ | ||
| ResponseMapFactory DEFAULT = new DefaultResponseMapFactory(); | ||
|
|
||
| Map<String, Object> create(List<String> fieldNames, List<Object> results); |
There was a problem hiding this comment.
I feel like this should be generic
<K,V> Map<K, V> create(List<K> fieldNames, List<V> results);
Also naming matters
The map we give back is insertion ordered. This is important at times
So I think the create method should be createInsertionOrdered(...)
Sorry, something went wrong.
There was a problem hiding this comment.
List<String> fieldNames, List<Object> results
the names here should be generic
List<String> keys, List<Object> values
Sorry, something went wrong.
There was a problem hiding this comment.
at some time in the future we might be using this to make more "maps" in different places say
Sorry, something went wrong.
There was a problem hiding this comment.
thanks for the feedback! I covered all the points but one: I left out the generics because it is in contrast with a comment from @andimarek.
I do see 2 alternatives:
it is acceptance to keep ResponseMapFactory without generics by now?
Sorry, something went wrong.
This will allows to customize which java.util.Map concrete class to use. For example, eclipse-collections has Map implementations with better memory footprint than JDK maps.
|
@andimarek @bbakerman hi guys, this PR is ready to be reviewed... or do you see something else missing? |
Sorry, something went wrong.
|
I am happy to take this PR in shape HOWEVER I dont think we should wire the MapResponseFactory into the graphql object This is unsual config - we dont expect people to use this very often. As such I think we should wire this into play via the new unusualConfiguration() mechanism If we had out time again I would do this for ValueUnboxer as well but that is a past decision and this is a present once So while I support the idea of a MapResponseFactory - it is not usual to expect this to be set and its clutters the API. Thoughts @andimarek ? |
Sorry, something went wrong.
|
I agree with @bbakerman here .. perfect for our very new unusual config area. second question @dfa1 : does it need to be a function doing so much? could it be a just a constructor/factory function? |
Sorry, something went wrong.
|
@dfa1 - we are likely to merge this PR and then change so that ResponseMapFactory is not set per GraphQL object but rather per execution. This fits in with our new "unusual configutation" mechanism AND it declutters the public common API |
Sorry, something went wrong.
There was a problem hiding this comment.
Approving but we are going to fix this up to the shape we want. This will be set per request not per GraphQL
Sorry, something went wrong.
|
thanks @bbakerman @andimarek ! 💯
@andimarek : yes, also a factory function is fine
@bbakerman in our projects, all requests will use same ResponseMapFactory...right now I cannot think a usecase to customize this per request rather per instance). We are using GraphQL.tranform extensively (and it is working nicely, by caching the instances via caffeine) to customize the behavior per request. ... of course, I'm going to change our code to use the "unusual configuration" mechanism you're proposing ;) |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Proposal for #3857. I would like to write a unit test too: the idea is to make sure that all nested maps are really built with the customization.