{"record":{"id":"1a9f0dc9a0827941","repo":"floci-io/floci","slug":"awsinteger-must-be-an-integer","errorCode":null,"errorMessage":"AWSInteger must be an integer","messagePattern":"AWSInteger must be an integer","errorType":"validation","errorClass":"CoercingParseLiteralException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java","lineNumber":333,"sourceCode":"    public static final GraphQLScalarType AWS_INTEGER = GraphQLScalarType.newScalar()\n        .name(\"AWSInteger\")\n        .description(\"A 32-bit signed integer\")\n        .coercing(new Coercing<Integer, Integer>() {\n            @Override\n            public Integer serialize(Object dataFetcherResult) {\n                if (dataFetcherResult == null) return null;\n                if (dataFetcherResult instanceof Number n) return n.intValue();\n                return Integer.parseInt(dataFetcherResult.toString());\n            }\n            @Override\n            public Integer parseValue(Object input) {\n                if (input instanceof Number n) return n.intValue();\n                return Integer.parseInt(input.toString());\n            }\n            @Override\n            public Integer parseLiteral(Object input) {\n                if (input instanceof graphql.language.IntValue iv) return iv.getValue().intValue();\n                throw new CoercingParseLiteralException(\"AWSInteger must be an integer\");\n            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_SHORT = GraphQLScalarType.newScalar()\n        .name(\"AWSShort\")\n        .description(\"A 16-bit signed integer (-32768 to 32767)\")\n        .coercing(new Coercing<Integer, Integer>() {\n            @Override\n            public Integer serialize(Object dataFetcherResult) {\n                if (dataFetcherResult instanceof Number n) return n.intValue();\n                return Integer.parseInt(dataFetcherResult.toString());\n            }\n            @Override\n            public Integer parseValue(Object input) {\n                int val;\n                if (input instanceof Number n) val = n.intValue();\n                else val = Integer.parseInt(input.toString());","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java#L315-L351","documentation":"Thrown by the AWSInteger scalar's parseLiteral when the inline literal in the query document is not an IntValue — i.e. it is a string, float, boolean, or null literal. The scalar requires a bare 32-bit integer literal in the document text.","triggerScenarios":"A query document contains f(n: \"7\"), f(n: 7.5), f(n: true), or f(n: null) where the argument/field is typed AWSInteger.","commonSituations":"Query builders quoting every interpolated value; JSON-style fixtures pasted into GraphQL documents (quoted numbers); float-typed constants (discount rates, scores) passed to integer fields; null literals used to mean 'skip' in inline positions.","solutions":["Write the bare integer literal: f(n: 7)","Round or convert floats to ints before interpolation: Math.round(x)","Pass values as $variables typed AWSInteger rather than inline literals","Null belongs in the variables map (variable set to null), not as an inline literal for this scalar"],"exampleFix":"# before\nquery { item(score: \"7\") } # quoted -> throws\n\n# after\nquery { item(score: 7) }","handlingStrategy":"type-guard","validationCode":"static String intLiteral(Object v) {\n    if (v instanceof Integer i) return i.toString();\n    throw new IllegalArgumentException(\"AWSInteger argument must be a bare int literal\");\n}","typeGuard":"const isInlineIntLiteral = (v: unknown): boolean => Number.isInteger(v);","tryCatchPattern":"catch (CoercingParseLiteralException e) { // unquote/round the literal or move it to a $variable }","preventionTips":["Render ints unquoted in generated documents","Round floats before use on integer fields","Use variables for dynamic values"],"tags":["graphql","appsync","awsinteger","parse-literal","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}