diff options
-rw-r--r-- | kolam/graphql.scm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kolam/graphql.scm b/kolam/graphql.scm index 59cc34f..0440f74 100644 --- a/kolam/graphql.scm +++ b/kolam/graphql.scm @@ -119,17 +119,19 @@ "Return non-#f if VALUE is of GraphQL TYPE. Else, return #f." (cond ((scalar-type? type) - ((scalar-type-predicate type) value)) + (or (eq? value 'null) + ((scalar-type-predicate type) value))) ((enum-type? type) (member value - (enum-type-enumerators type))) + (cons 'null (enum-type-enumerators type)))) ((non-nullable-type? type) (and (not (eq? value 'null)) (correct-type? value (non-nullable-type-subtype type)))) ((list-type? type) - (and (list? value) - (every (cut correct-type? <> (list-type-subtype type)) - value))) + (or (eq? value 'null) + (and (list? value) + (every (cut correct-type? <> (list-type-subtype type)) + value)))) ((object-type? type) #t) (else (error "Unknown type:" type)))) |