Skip to content

ValidationError VariableTypeNotFound despite presence in the schema #204

@EdmundsEcho

Description

@EdmundsEcho

Might anyone know what might cause the VariableTypeNotFound error from compileQuery being generated despite, what seems like a valid schema that includes the type requested type definition?

Here is what I'm seeing: The call

  let query =
        compileQuery
        schema 
        [r|query($vi: RequestInput!) {     

             wrap {       # Object :: Commands.Validate 
                          # (wraps a Field "validate" with Argument "request" :: RequestInput)
 
              validate(request: $vi)  {
                      subReq  { subjectType }
                      meaReqs { measurementType }
               }
             }
           }
           |]

... generates a Left error implying a missing type definition

Left (ValidationError (VariableTypeNotFound (Variable (Name {unName = "vi"}))
(Name {unName = "RequestInput"}) :| []))

... despite the definition being present in the successful makeSchema call

-- snippet of the compiled schema

... (Name {unName = "Validate"},TypeDefinitionObject (ObjectTypeDefinition
(Name {unName = "Validate"}) [] (FieldDefinition (Name {unName = "validate"})
[ArgumentDefinition (Name {unName = "request"}) 
(TypeNonNull (NonNullTypeNamed 
(DefinedInputType 
(InputTypeDefinitionObject 
(InputObjectTypeDefinition 
(Name {unName = "RequestInput"})       <<< definition of RequestInput
 
(InputObjectFieldDefinition (Name {unName ="subReq"}) (TypeNonNull (NonNullTypeNamed (DefinedInputType (InputTypeDefinitionObject (InputObjectTypeDefinition (Name {unName =
"QualityMixInput"}) (InputObjectFieldDefinition (Name {unName = "subjectType"})
(TypeNamed (BuiltinInputType GString)) Nothing :| [InputObjectFieldDefinition
(Name {unName = "qualityMix"}) ... etc.

Thank you to anyone that might have some ideas.

- E

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions