-
Notifications
You must be signed in to change notification settings - Fork 275
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
test @inaccessible in response formatting #1033
Conversation
✅ Deploy Preview for apollo-router-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This comment has been minimized.
This comment has been minimized.
if @inaccessible is set on an object type, a client should not be able to receive a value of that type. Instead, it should be replaced with a null, without an error. An inaccessible type will not appear in the API schema that we use for response formatting, so when we get an object with a __typename field, we check if that typ ename is known in the schema's object types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,
Just to replay my understanding:
If the concrete type is not in the schema because it was inaccessible then we just zap the contents.
Otherwise if the field is inaccessible then the existing logic will take care of things as the field will be absent from the API schema.
"test_union": null, | ||
"test_union2": { | ||
"__typename": "B", | ||
"common": "hello", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, how come b
is not output for union2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be my mistake, or it could be a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the query does not call for this field:
test_union2: test_union {
...on B {
__typename
common
}
}
Both cases are taken care of by the API schema: an inaccessible object type won't appear in the API schema, in the same way an inaccessible field won't be in the schema |
Fix #1030