Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 57e32d7

Browse files
leebyronyaacovCR
authored andcommittedMay 31, 2023
RFC: Default value validation & coercion
Implements graphql/graphql-spec#793 * Adds validation of default values during schema validation. * Adds coercion of default values anywhere a default value is used at runtime Potentially breaking: * Remove `astFromValue` * Changes type of `defaultValue` provided during type configuration from an "internal" to an "external" value.
1 parent 2f37daa commit 57e32d7

13 files changed

+866
-562
lines changed
 

‎cspell.yml

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ ignoreRegExpList:
2727

2828
words:
2929
- graphiql
30+
- sublinks
31+
- instanceof
32+
- uncoerce
33+
- uncoerced
3034

3135
# Different names used inside tests
3236
- Skywalker

‎src/execution/__tests__/variables-test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ const TestType = new GraphQLObjectType({
126126
}),
127127
fieldWithNestedInputObject: fieldWithInputArg({
128128
type: TestNestedInputObject,
129-
defaultValue: 'Hello World',
130129
}),
131130
list: fieldWithInputArg({ type: new GraphQLList(GraphQLString) }),
132131
nnList: fieldWithInputArg({

‎src/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,6 @@ export {
442442
typeFromAST,
443443
// Create a JavaScript value from a GraphQL language AST without a Type.
444444
valueFromASTUntyped,
445-
// Create a GraphQL language AST from a JavaScript value.
446-
astFromValue,
447445
// A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system.
448446
TypeInfo,
449447
visitWithTypeInfo,

‎src/type/__tests__/enumType-test.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ const QueryType = new GraphQLObjectType({
6363
args: {
6464
fromEnum: {
6565
type: ComplexEnum,
66-
// Note: defaultValue is provided an *internal* representation for
67-
// Enums, rather than the string name.
68-
defaultValue: Complex1,
66+
defaultValue: 'ONE',
6967
},
7068
provideGoodValue: { type: GraphQLBoolean },
7169
provideBadValue: { type: GraphQLBoolean },

0 commit comments

Comments
 (0)
Please sign in to comment.