Skip to content

Empty type definitions do not record origins #1010

@duckki

Description

@duckki

Description

Empty type definitions that don't have any directive applications or fields won't contain any origins in the struct. This affects the correctness of iter_origins() methods.

Example

type T

extend type T {
  field: Int
}

The iter_origins() methods only returns an extension origin, not the definition origin.

Possible solutions

I filed a possible fix PR (#1009), which is a breaking change.
It appears that any fix would be a breaking change and we may consider a larger re-design for 2.0.

  • The PR proposed to add a new definition_origin field to schema definition and various type structs.
  • Another suggestion was to use the Component type everywhere, replacing the Node type. Also, this overlaps with compiler: two separate DirectiveList types are inconvenient #851 (about unifying DirectiveList<Node<...>> and DirectiveList<Component<...>>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions