-
Notifications
You must be signed in to change notification settings - Fork 32
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
AppSync empty selectionSetList in the GraphQL Info Object #358
Comments
I ran in to the same issue. And I don't know how many times I read the documentation, but the last time I read it I saw this:
So it seems like it's by design and not much that can be done about it.. I have a similar setup to you, where they can't share fields in an Maybe something like this could work, and passing it the export const gqlToSelectionSetList = (str: string) => {
const START_TOKEN = '{';
const END_TOKEN = '}';
const FRAGMENT_TOKEN = '.';
const SPACE_TOKEN = ' ';
const FRAGMENT_DECLARATION_TOKEN = 'on';
const selectionSetList: string[] = [];
const path: string[] = [];
let curr: string = '';
let prev: string = '';
for (const c of str.replaceAll('\n', '')) {
switch (c) {
case FRAGMENT_TOKEN: {
break;
}
case SPACE_TOKEN: {
if (curr !== FRAGMENT_DECLARATION_TOKEN && curr !== '') {
selectionSetList.push([...path, curr].join('/'));
prev = curr;
}
curr = '';
break;
}
case START_TOKEN: {
if (prev) path.push(prev);
break;
}
case END_TOKEN: {
path.pop();
break;
}
default: {
curr = curr + c;
}
}
}
return selectionSetList;
}; I have no idea how robust this would be, or if this is a solution 😄 |
@osadi Thanks for pointing out to the documentation. It seems to explain the behaviour. |
Hello,
It seems selectionSetList is always empty when running queries returning a union type.
Simplified schema example:
Query Example:
Lambda function receives $event.info.selectionSetList = [] for such type of queries on AWS AppSync.
Is there anything one can do to make it work?
P.S: It works correctly when running locally using Amplify AppSyncSimulator.
The text was updated successfully, but these errors were encountered: