graphql-rust / juniper

GraphQL server library for Rust
Other
5.72k stars 425 forks source link

Expose name and alias in `LookAheadMethods` #1199

Closed soerenmeier closed 1 year ago

soerenmeier commented 1 year ago

Currently it is only possible to get the name or if an alias is present the alias, or I'm missing something. This exposed the name and alias separately. I'm not sure about the name field_unique_name.

tyranron commented 1 year ago

@soerenmeier I did some investigation on the naming and didn't find any consistency regarding the naming.

graphql-parse-resolve-info npm package has it in the following way:

  • name: the name of the GraphQL field
  • alias: the alias this GraphQL field has been requested as, or if no alias was specified then the name

graphql-ruby has only this:

#name ⇒ String(also: #graphql_name) readonly The GraphQL name for this field, camelized unless camelize: false is provided.

#original_name ⇒ Symbol readonly The original name of the field, passed in by the user.

So, I propose to remain field_unique_name as field_name, while the proposed field_name being named as field_original_name. This way, we'll preserve backwards compatibility and naming consistency over all the methods.