{"record":{"id":"805f46e8a72ddfb8","repo":"floci-io/floci","slug":"awsfloat-must-be-a-number","errorCode":null,"errorMessage":"AWSFloat must be a number","messagePattern":"AWSFloat must be a number","errorType":"validation","errorClass":"CoercingParseLiteralException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java","lineNumber":383,"sourceCode":"        .name(\"AWSFloat\")\n        .description(\"An IEEE 754 double-precision float\")\n        .coercing(new Coercing<Double, Double>() {\n            @Override\n            public Double serialize(Object dataFetcherResult) {\n                if (dataFetcherResult == null) return null;\n                if (dataFetcherResult instanceof Number n) return n.doubleValue();\n                return Double.parseDouble(dataFetcherResult.toString());\n            }\n            @Override\n            public Double parseValue(Object input) {\n                if (input instanceof Number n) return n.doubleValue();\n                return Double.parseDouble(input.toString());\n            }\n            @Override\n            public Double parseLiteral(Object input) {\n                if (input instanceof graphql.language.FloatValue fv) return fv.getValue().doubleValue();\n                if (input instanceof graphql.language.IntValue iv) return iv.getValue().doubleValue();\n                throw new CoercingParseLiteralException(\"AWSFloat must be a number\");\n            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_BIG_DECIMAL = GraphQLScalarType.newScalar()\n        .name(\"AWSBigDecimal\")\n        .description(\"An arbitrary-precision decimal number\")\n        .coercing(new Coercing<String, String>() {\n            @Override\n            public String serialize(Object dataFetcherResult) {\n                return dataFetcherResult != null ? dataFetcherResult.toString() : null;\n            }\n            @Override\n            public String parseValue(Object input) {\n                String str = input.toString();\n                try {\n                    new BigDecimal(str);\n                } catch (NumberFormatException e) {","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java#L365-L401","documentation":"Thrown by the AWSFloat scalar's parseLiteral when the inline literal is neither a FloatValue nor an IntValue (e.g. a string or boolean literal). The scalar accepts both decimal and whole-number literals on the literal path, converting integers to double, but rejects everything else.","triggerScenarios":"A query document contains f(x: \"1.5\"), f(x: true), or f(x: null) where the argument is typed AWSFloat.","commonSituations":"Quoted numbers from template engines; JSON payload pasted as inline arguments; boolean/null sentinels where a number was intended; codegen rendering all values as strings.","solutions":["Send the bare numeric literal: f(x: 1.5) or f(x: 2)","Pass dynamic values as $variables typed AWSFloat","Fix the query builder so numbers are not stringified","Check for accidental boolean/null literals from templating conditionals"],"exampleFix":"# before\nquery { stats(ratio: \"0.75\") }\n\n# after\nquery { stats(ratio: 0.75) }","handlingStrategy":"type-guard","validationCode":"static String floatLiteral(double v) { return String.valueOf(v); } // renders unquoted 1.5 or 2.0\nstatic String floatLiteral(Number n) { if (!(n instanceof Double || n instanceof Integer)) throw new IllegalArgumentException(\"AWSFloat literal must be numeric\"); return n.toString(); }","typeGuard":"const isAwsFloatLiteral = (v: unknown): boolean => typeof v === 'number' && !Number.isNaN(v);","tryCatchPattern":"catch (CoercingParseLiteralException e) { // unquote the numeric literal or move it to a $variable }","preventionTips":["Never quote floats in documents","Accept that integer literals are fine for AWSFloat (both are valid)","Use variables for computed values"],"tags":["graphql","appsync","awsfloat","parse-literal","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}