-
Notifications
You must be signed in to change notification settings - Fork 0
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
suggestions based on original review comments #7
Conversation
src/utilities/TypeInfo.ts
Outdated
@@ -38,6 +39,14 @@ import type { GraphQLSchema } from '../type/schema.js'; | |||
import { typeFromAST } from './typeFromAST.js'; | |||
import { valueFromAST } from './valueFromAST.js'; | |||
|
|||
export interface GraphQLSignature { |
There was a problem hiding this comment.
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.
src/utilities/TypeInfo.ts
Outdated
@@ -129,6 +140,10 @@ export class TypeInfo { | |||
return this._argument; | |||
} | |||
|
|||
getSignature(): Maybe<GraphQLSignature> { |
There was a problem hiding this comment.
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.
Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋 Supported commandsPlease post this commands in separate comments and only one per comment:
|
1190b79
to
1d770fb
Compare
There was a problem hiding this 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
9de28dc
to
b422131
Compare
6c1a90f
to
dac365d
Compare
dac365d
to
b422131
Compare
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