fix: navigate docs for input object fields - #4442
Conversation
🦋 Changeset detectedLatest commit: 31bd0a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
|
Thanks for the PR! The part that's giving me pause is threading I'm imagining something around the case RuleKinds.OBJECT_VALUE:
const objectType = getNamedType(inputType!);
objectFieldDefs = objectType instanceof GraphQLInputObjectType
? objectType.getFields()
: null;If we held onto Let me know what you think! |
That makes sense and avoids the reverse schema lookup. One concern is that AllTypeInfo is exported from graphql-language-service, while the doc explorer accepts older @graphiql/react versions that won’t populate the new field. Would you prefer that I make inputObjectType optional and retain a compatibility fallback, or update the relevant package versions/peer range as part of this PR? |
|
@pur3miish good observation. I'd be happy with the latter (no back-compat with proper versioning bumps). I'm pretty sure this just means adding a So just make sure that entry is added to the changeset as well and I'll make sure the versioning is correct before release. Thanks! I believe this changesets PR is relevant to our scenario. |
|
@trevor-scheer Thanks for the guidance! I’ve updated the PR based on your recommendation:
The affected tests, type checks, formatting, and lint checks pass. After updating the branch, the Changesets bot currently calculates major bumps for the Documentation Explorer and the other |
|
Hi @trevor-scheer — friendly follow-up. The parser-level change and requested |
|
Hey @pur3miish, thank you for your patience. I'm solo parenting for the week and pretty preoccupied, I'll try to get to this as soon as I'm able to but it probably won't be until next week. |
Summary
ObjectFieldschema references in the Documentation ExplorerinputObjectTypeinAllTypeInfo@graphiql/react,graphql-language-service, and@graphiql/plugin-doc-explorerRoot cause
The operation editor already emits an
ObjectFieldschema-reference event for command/control-clicks inside input object literals. The Documentation Explorer did not handle that event, andgetTypeInforetained only the input object's field map—not the owning input-object type needed to build the documentation navigation path.Implementation
inputObjectTypetoAllTypeInfoand populate it while processingOBJECT_VALUEtypeInfo.inputObjectTypegetTypeMap()lookup fromgetSchemaReference@graphiql/react: majorgraphql-language-service: minor@graphiql/plugin-doc-explorer: patchTesting
graphql-language-service: 277 tests passed@graphiql/plugin-doc-explorer: 21 tests passedFixes #4441