Skip to content

suggestions based on original review comments#7

Closed
yaacovCR wants to merge 0 commit intoJoviDeCroock:fragment-args-typeinfo-2024from
yaacovCR:review-feedback
Closed

suggestions based on original review comments#7
yaacovCR wants to merge 0 commit intoJoviDeCroock:fragment-args-typeinfo-2024from
yaacovCR:review-feedback

Conversation

@yaacovCR
Copy link
Copy Markdown
Collaborator

introduces new signature type that works across GraphQLArgument and VariableDefinitionNode, retaining getArgument() for backwards compatibility for the time being.

the signature type checks to make sure that there is an input type for the fragment variable and generates the default value.

also generates the appropriate fragment variable "signatures" once per document, as suggested, although without the schema pieces

Comment thread src/utilities/TypeInfo.ts Outdated
import { typeFromAST } from './typeFromAST.js';
import { valueFromAST } from './valueFromAST.js';

export interface GraphQLSignature {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could introduce a new GraphQLFragmentVariableSignature interface. If we wanted we could also have a union type GraphQLSignature = GraphQLArgument | GraphQLFragmentVariableSignature.

I believe the basic learning from this PR is that we can't have a union over VariableDefinitionNode itself, because we have to validate the type and generate the actual default value.

Comment thread src/utilities/TypeInfo.ts Outdated
return this._argument;
}

getSignature(): Maybe<GraphQLSignature> {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively we could expose a getFragmentVariableSignature() helper that only returns a value if we are within an argument for a fragment variable. Or we could have both the more specific and the more generic helpers.

@github-actions
Copy link
Copy Markdown

Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@JoviDeCroock JoviDeCroock force-pushed the fragment-args-typeinfo-2024 branch 3 times, most recently from 1190b79 to 1d770fb Compare August 20, 2024 14:53
Copy link
Copy Markdown
Owner

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a 1 commit rebase on top of the typeinfo PR

@JoviDeCroock JoviDeCroock force-pushed the fragment-args-typeinfo-2024 branch 2 times, most recently from 9de28dc to b422131 Compare August 20, 2024 15:40
@yaacovCR yaacovCR force-pushed the review-feedback branch 3 times, most recently from 6c1a90f to dac365d Compare August 23, 2024 15:46
@yaacovCR yaacovCR closed this Aug 23, 2024
@yaacovCR yaacovCR deleted the review-feedback branch September 5, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants