{"record":{"id":"06ea3790b163afb4","repo":"floci-io/floci","slug":"awsshort-must-be-an-integer","errorCode":null,"errorMessage":"AWSShort must be an integer","messagePattern":"AWSShort 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":359,"sourceCode":"        .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());\n                if (val < -32768 || val > 32767)\n                    throw new CoercingParseValueException(\"AWSShort out of range: \" + val);\n                return val;\n            }\n            @Override\n            public Integer parseLiteral(Object input) {\n                if (input instanceof graphql.language.IntValue iv) return parseValue(iv.getValue().intValue());\n                throw new CoercingParseLiteralException(\"AWSShort must be an integer\");\n            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_FLOAT = GraphQLScalarType.newScalar()\n        .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());","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java#L341-L377","documentation":"Thrown by the AWSShort scalar's parseLiteral when the inline literal in the query document is not an IntValue (string, float, boolean, or null literal). Like the other integer scalars, AWSShort requires a bare integer literal in the document text, then range-checks it via parseValue.","triggerScenarios":"A query document contains f(s: \"100\"), f(s: 100.0), or f(s: null) for an argument typed AWSShort.","commonSituations":"Query-builders quoting all interpolations; JSON-derived documents with quoted numbers; float literals from calculators/ratios; copy-paste from variable JSON into the document body.","solutions":["Use a bare integer literal: f(s: 100)","Ensure interpolated shorts skip the string-quoting path in template code","Pass via $variable typed AWSShort for dynamic values","Lint documents: quoted numerics on AWSShort arguments are always wrong"],"exampleFix":"# before\nquery { device(mode: \"100\") }\n\n# after\nquery { device(mode: 100) }","handlingStrategy":"type-guard","validationCode":"static String shortLiteral(Object v) {\n    if (v instanceof Integer i && i >= -32768 && i <= 32767) return i.toString();\n    throw new IllegalArgumentException(\"AWSShort literal must be a bare int in [-32768, 32767]\");\n}","typeGuard":"const isAwsShortLiteral = (v: unknown): boolean => Number.isInteger(v) && v >= -32768 && v <= 32767;","tryCatchPattern":"catch (CoercingParseLiteralException e) { // unquote the literal, re-range-check, resend }","preventionTips":["Never quote short values in documents","Prefer variables typed AWSShort","Lint documents for quoted numerics on scalar arguments"],"tags":["graphql","appsync","awsshort","parse-literal","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}