gql
gql copied to clipboard
[codegen] separate reserved names for top identifiers and reserved names for built_value fields
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