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

Conditional directive application based on @tag names #2820

Open
lleadbet opened this issue Oct 12, 2023 · 1 comment
Open

Conditional directive application based on @tag names #2820

lleadbet opened this issue Oct 12, 2023 · 1 comment

Comments

@lleadbet
Copy link
Contributor

Given the value of Contracts a way to split out supergraphs from a source variant, there's often use-cases where some directives may only apply to a subset of produced contracts.

Federation should enable a way to do so through a proposed new dircective @applyOnTag where, as the name implies, it'll only apply a given directive on a field if it were to be composed into the resulting contract.

As an example, deprecating fields for a given contract can be helpful, thus: field: String @applyOnTag(tag:"public", directive: "@deprecated(reason:\"test\")") (or similar).

Or for the new AuthN/Z directives, applying conditional scope checks based on the type of contract, as auth models may differ on certain contracts vs. others.

@lleadbet
Copy link
Contributor Author

For the first example use-case, an alternative could be to accept a deprecated argument on the tag directive itself which would, during composition, apply a deprecated directive with the reason matching the deprecated string passed.

The other use-case, however, wouldn't be possible without adding a tag directive to those directives.

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

No branches or pull requests

2 participants