Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Support destination_collection deducible from a parent object #8

Closed
4 tasks
Totktonada opened this issue Jan 24, 2018 · 0 comments
Closed
4 tasks

Support destination_collection deducible from a parent object #8

Totktonada opened this issue Jan 24, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request prio1

Comments

@Totktonada
Copy link
Member

Totktonada commented Jan 24, 2018

http://graphql.org/learn/schema/#union-types

Current connection format:

{
    name = 'connection_name_bar',
    destination_collection = 'collection_baz',
    type = '1:1',
    parts = {
        {
            source_field = 'field_name_source_1',
            destination_field = 'field_name_destination_1'
        },
        ...
    },
    index_name = 'index_name'
}   

Proposed the second connection format:

{
    name = 'connection_name_bar',
    type='1:1',
    variants = {
        {
           filter = {foo = 1, bar = 'id_1'},
           destination_collection = 'collection_baz',
           parts = {
               {   
                   source_field = 'field_name_source_1',
                   destination_field = 'field_name_destination_1'
               },  
               ... 
            }
            index_name = 'index_name'
         },  
         ... 
     }
}

We can move source_fields upward from variants, but I like the idea of maximum reusability of the current code (for now, at least). The format of 'filter' choosen from the same idea.

  • tarantool_graphql (validation): expand connection validation with support of the second connection format;
  • tarantool_graphql (graphql schema generation): for such connections: generate all possible types and construct the union as the graphql type of the corresponding connection field;
  • tarantool_graphql (resolve functions): expand from parameter of accessor:select() to be list of filter, from pairs, expand collection_name to be list of such collection names (in the corresponding order);
  • accessor_general: save select_internal as is, but before invoke it do the following: match parent with filters from the from argument one by one and choose the Nth collection_name from the list collection_name, pass the found collection name and certain from variant to the unchanged select_internal.

Debatable: the avro_schema_changes.org document restricts tag value type to number / string and utilizes type conversion, that seems not good for me. Maybe we must specify tag value as a value of some field, not as a key. I proposed more powerfull way that allows to reuse the existing code of our library as much as possible.

@Totktonada Totktonada added prio1 enhancement New feature or request labels Feb 1, 2018
This was referenced Mar 6, 2018
SudoBobo added a commit that referenced this issue Mar 13, 2018
SudoBobo added a commit that referenced this issue Mar 13, 2018
SudoBobo added a commit that referenced this issue Mar 13, 2018
SudoBobo added a commit that referenced this issue Mar 13, 2018
@SudoBobo SudoBobo mentioned this issue Mar 13, 2018
SudoBobo pushed a commit that referenced this issue Mar 13, 2018
SudoBobo added a commit that referenced this issue Mar 13, 2018
SudoBobo added a commit that referenced this issue Mar 13, 2018
@SudoBobo SudoBobo mentioned this issue Mar 14, 2018
SudoBobo added a commit that referenced this issue Jul 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request prio1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants