Skip to content

Commit 0d9db20

Browse files
authored
fix: use original field names for struct 'json:X' annotations
Use original field names for struct 'json:X' annotations
2 parents c489066 + 2af04e0 commit 0d9db20

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/generator.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,13 @@ export class GolangGenerator {
331331
}
332332
w.push('struct {')
333333
} else {
334-
w.push(`string \`json:"${name}"\``)
334+
w.push(`string \`json:"${field.name.value}"\``)
335335
}
336336
l.push(w.join(''))
337337
},
338338
leave: field => {
339339
if (field.selectionSet) {
340-
const name = this.formatName(field.name.value)
341-
l.push(`} \`json:"${name}"\``)
340+
l.push(`} \`json:"${field.name.value}"\``)
342341
}
343342
},
344343
},

0 commit comments

Comments
 (0)