~theo/gql#29: 
Resolve abstract type

In this function we want to return an `object-type-definition', but we need to resolve it from an abstract type. We cannot use the interface/union itself, so we need to find the actual implementors.

General algorithm here:

  1. If abstract-type = interface

    • Check if object-value is subtype of abstract-type
    • If yes then return the proper object type definition
  2. If abstract-type = union

    • Check if object-value is one of union members
    • If yes then return the proper object type definition

So what we need is to be able to check the actual name up against the proper types as defined in the schema. Is it reasonable to expect from the users to use our implementation of defclass? Let's say we have a macro gqlobject, make-object or something like that. Then we can make sure that the user supplies the proper name. This would make us not rely on casing when checking types in the abstract resolver. Possibly other places as well.

With such an implementation we can actually make sure that the types returned from database etc can be checked up against the ones defined in the schema.

Status
RESOLVED IMPLEMENTED
Submitter
~theo
Assigned to
No-one
Submitted
8 months ago
Updated
7 months ago
Labels
Execution

~theo REPORTED IMPLEMENTED 8 months ago

This is now implemented in master, so at least we have a starting off point for this.

~theo 8 months ago

Theodor Thornhill referenced this ticket in commit d257076.

~theo 7 months ago

Theodor Thornhill referenced this ticket in commit d257076.

Register here or Log in to comment, or comment via email.