Skip to content

Add a config option to generate fields in apollo-tooling way #10561

@ikusakov2

Description

@ikusakov2

Is your feature request related to a problem? Please describe.

Currently, then generating with extractAllFieldsToTypes: true option, the type names are rendered using both field name and field type:

export type getFooData_foo_Foo_location_FooLocation_address_FooAddress = {
  __typename: 'FooAddress',
  formatted?: string | null
};

In Apollo tooling however, the type names are rendered using field names only:

export type getFooData_foo_location_address = {
  __typename: 'FooAddress',
  formatted?: string | null
};

Describe the solution you'd like

We would like to add an option (for example extractAllFieldsToTypesFieldNamesOnly) that renders type names in a way compatible to Apollo tooling:

config: {
   extractAllFieldsToTypes: true,
   extractAllFieldsToTypesFieldNamesOnly: true
}

Note, that for practical usage with deeply nested objects Apollo tooling notation is more comfortable to use:
getFooData_foo_Foo_location_FooLocation_address_FooAddress vs getFooData_foo_location_address

Describe alternatives you've considered

An alternative would be to migrate all types which are used in our code to the new format.
In our case it is ~200 cases.

Any additional important details?

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions