Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@link spec vs implementation considerations #43

Open
goto-bus-stop opened this issue Jan 19, 2024 · 0 comments
Open

@link spec vs implementation considerations #43

goto-bus-stop opened this issue Jan 19, 2024 · 0 comments

Comments

@goto-bus-stop
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant