Skip to content

Bug in buildASTSchema: Adding a Float scalar to type definition breaks the materializer #104

@nemanja-stanarevic

Description

@nemanja-stanarevic

When a Float field is added to type definition, the materializer (buildASTSchema) breaks down with Error: Type Float not found in document. Adding a float field to HelloScalars test confirms the issue.

Patch is simple, one-line tweak to getTypeDefProducer function in utilities/buildASTSchema.js to add Float to innerTypeMap map, as follows:

  function getTypeDefProducer() {

    var innerTypeMap = {
      String: GraphQLString,
      Int: GraphQLInt,
++++  Float: GraphQLFloat,
      Boolean: GraphQLBoolean,
      ID: GraphQLID,
    };

With this, the new HelloScalars test passes, I'll submit a PR in a sec (updated test + patch).

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