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

fix(transforms): preserve aliases #1799

Merged
merged 1 commit into from
Jul 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/stitch/tests/alternateStitchSchemas.test.ts
Expand Up @@ -689,6 +689,12 @@ describe('transform object fields', () => {
}
return fieldName;
}),
new RenameObjectFields((_typeName, fieldName) => {
if (fieldName === 'camelCase') {
return 'prefixCamelCase';
}
return fieldName;
}),
]);
});

Expand All @@ -698,12 +704,12 @@ describe('transform object fields', () => {
`
query {
item {
camelCase
prefixCamelCase
}
items {
edges {
node {
camelCase
prefixCamelCase
}
}
}
Expand All @@ -712,7 +718,7 @@ describe('transform object fields', () => {
);

const TRANSFORMED_ITEM = {
camelCase: "I'm a camel!",
prefixCamelCase: "I'm a camel!",
};

expect(result).toEqual({
Expand Down
2 changes: 1 addition & 1 deletion packages/wrap/src/transforms/TransformCompositeFields.ts
Expand Up @@ -182,7 +182,7 @@ export default class TransformCompositeFields implements Transform {
},
alias: {
kind: Kind.NAME,
value: newName,
value: transformedSelection.alias?.value ?? newName,
},
});
});
Expand Down