Skip to content

@link spec vs implementation considerations #43

@goto-bus-stop

Description

@goto-bus-stop

This is to note some inconsistencies between the @link spec text and the existing implementations (in particular, in @apollo/federation).

I'm not proposing immediate action, but I think it will be a helpful reference to have these differences explicitly written down.

  • URL-ness -- according to the spec, @link(url:) can be a string that is not a valid URL:

    If url: is not a valid RFC 3986 url, then it MUST be treated as an opaque identifier for the foreign schema. Such non-URL inputs to url: SHOULD NOT have name and version information extracted from them—both are {null}.

    @apollo/federation does not accept non-URL values.

  • Optional name and version -- the spec says a name and version MAY be provided in @link(url:). @apollo/federation requires both.

  • Name syntax -- the spec says a spec name in @link(url:) MUST be a valid GraphQL name (if it exists). @apollo/federation does not enforce this, and happily parses invalid names. In practice this doesn't affect the behaviour much, as users cannot write definitions for namespaced elements where the namespace is invalid, so it just means that everything has to be explicitly imported or aliased.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions