Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestions based on original review comments #7

Conversation

yaacovCR
Copy link
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

@@ -38,6 +39,14 @@ import type { GraphQLSchema } from '../type/schema.js';
import { typeFromAST } from './typeFromAST.js';
import { valueFromAST } from './valueFromAST.js';

export interface GraphQLSignature {
Copy link
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.

@@ -129,6 +140,10 @@ export class TypeInfo {
return this._argument;
}

getSignature(): Maybe<GraphQLSignature> {
Copy link
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.

Copy link

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
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