Skip to content

Create predicates from type fields #4085

@campoy

Description

@campoy

Experience Report

It is confusing that when you declare a field in a type this is not taken into account automatically by the schema.

What you wanted to do

In issue #4080, a user created a type with a field head of type uid to keep a 1:1 relationship.

What you actually did

Since they didn't create the corresponding predicate in the schema head: uid ., once they sent the first mutation with a head predicate pointing to a uid, the predicate was created.

The problem is this predicate was created with type head: [uid] . therefore breaking the user's expectations.

Why that wasn't great, with examples

This made the user think 1:1 relationships were not supported.
Their expectations were justified.

Instead, I would have expected that if you create a type with field head uid in a type a corresponding predicate would be created.

This also includes the fact that if two types are created with the same name but different types an error should be returned.

Any external references to support your case

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/schemaIssues related to the schema language and capabilities.area/typesIssues related to the type system.kind/enhancementSomething could be better.priority/P2Somehow important but would not block a release.status/acceptedWe accept to investigate/work on it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions