graphql / graphql/graphiql

Discussion: getAutocompleteSuggestions

Open
#940 2 comments 0 reactions 0 assignees View on GitHub
codemirror-graphql discussion
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

Hi all,

I was thinking to add a new property `graphQLType` into items of returned array from [getAutocompleteSuggestions](https://github.com/graphql/graphiql/blob/v2.0.1/packages/interface/src/getAutocompleteSuggestions.js#L53), which is a type of [GraphQLType](https://github.com/graphql/graphql-js/blob/v14.4.2/src/type/definition.js#L46) and a type object related to the returned label. The reason I was thinking to do it is [here](https://github.com/graphql/graphiql/pull/902#pullrequestreview-267521414).

However, I noticed that this change would affect applications and libraries using `getAutocompleteSuggestions`. One of these is [graphql-language-service-server](https://github.com/graphql/graphiql/tree/v2.0.1/packages/server). I think this library doesn't like this change because it's not only necessary at all but also increases the amount of transferred data.

So I'm now thinking I'll create a new function instead in [codemirror-grpahql](https://github.com/graphql/codemirror-graphql/tree/v0.8.3) that returns `graphQLType` property instead of `detail` property. Also, some functions used in `getAutocompleteSuggestions` can be also used in this new function so I want to export those functions from `getAutocompleteSuggestions` and [graphql-language-service-interface](https://github.com/graphql/graphiql/tree/v2.0.1/packages/interface) and use them in the new function.

What do you think of this idea? Thanks for your opinion in advance.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.