gql icon indicating copy to clipboard operation
gql copied to clipboard

[codegen] separate reserved names for top identifiers and reserved names for built_value fields

Open knaeckeKami opened this issue 1 year ago • 0 comments

Right now, there is one list of reserved names which get escaped when used as an identifier. This list includes reserved keywords in dart (like class) and names which are reserved by built_value (like 'toJson') and cannot be used as name for a field in built_value.

Since we also generate top-level constants, this single list is too restrictive and might lead to escaping of names when it is not needed.

Example: It is valid to define a top-level constant with the name 'rebuild', but we would still escape the name of the top-level constants which is generated from a directive like

directive @rebuild on FIELD_DEFINITION

to Grebuild

knaeckeKami avatar Aug 06 '22 11:08 knaeckeKami