gintautassulskus / graphql_proposal_map

0 stars 0 forks source link

Heterogeneous valueType #1

Open serle opened 6 years ago

serle commented 6 years ago

Great work?

Currently I can create an array of key-value pairs run a transform on either end, but what we really need is the ability to hold values of different types in the map. I am happy with a string or ID key, but have situations where

1) the valueType would need to be a union or an interface 2) the valueType would need to be one of multiple scalars e.g. different values are strings, integers, booleans etc.

This would need to apply both for Types and Inputs and should also align with the proposal on input unions. Could you elaborate on these cases.

gintautassulskus commented 6 years ago

Hi @serle, thanks for the feedback.

The proposed Map(String, ValueType) builds on the already existing Graphql types and just defines the layout of the data. The principle is identical to the list collection type where [ValueType] simply defines the layout of the data and is not concerned with the ValueType 'internals'. Having said that, whatever works with a list [ValueType], will work with Maps(String, ValueType).

Does that sound right?

serle commented 6 years ago

@gintautassulskus

I understand where your perspective, but we typically use maps in more dynamic situations. Currently we place a typename in a value object and deserialize accordingly. it would be great to allow for this capability.