typedb/typedb-protocol

Simplify Concept API by replacing `overridden`, `explicit` etc. methods with parameters

Closed this issue · 1 comments

Problem to Solve

We currently have a very large number of Concept API methods - and a lot of them feel like they should just be overloads rather than being separate methods. For example:

ThingType.GetOwns.Req thing_type_get_owns_req = 303;
ThingType.GetOwnsExplicit.Req thing_type_get_owns_explicit_req = 310;
ThingType.GetOwnsOverridden.Req thing_type_get_owns_overridden_req = 311;

Proposed Solution

In the example above, explicit and overridden should really be parameters - not methods in their own right. We should add them to ThingType.GetOwns.Req:

    message GetOwns {
        message Req {
            oneof filter {
                AttributeType.ValueType value_type = 1;
            }
            bool keys_only = 2;
            bool explicit_only = 3;
            bool overridden_only = 4;
        }
        message ResPart {
            repeated Type attribute_types = 1;
        }
    }

We can apply this same simplification to a great number of Concept API methods to bring down the total count.

Resolved by #183