Skip to content

Commit 4e2b689

Browse files
graph codegen: fix bug with id field clash in example entity (#1971)
1 parent 30f2aa5 commit 4e2b689

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.changeset/purple-files-think.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/graph-cli': patch
3+
---
4+
5+
`graph codegen`: fix bug with id field clash in example entity

packages/cli/src/scaffold/schema.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,10 @@ export const generateExampleEntityType = (protocol: Protocol, events: any[]) =>
8989
id: Bytes!
9090
count: BigInt!
9191
${events[0].inputs
92-
.reduce(
93-
(acc: any[], input: any, index: number) =>
94-
acc.concat(generateEventFields({ input, index, protocolName: protocol.name })),
95-
[],
96-
)
92+
.reduce((acc: any[], input: any, index: number) => {
93+
input.name = renameNameIfNeeded(input.name);
94+
return acc.concat(generateEventFields({ input, index, protocolName: protocol.name }));
95+
}, [])
9796
.slice(0, 2)
9897
.join('\n')}
9998
}`;

0 commit comments

Comments
 (0)