{"record":{"id":"ab445dc455e8b28d","repo":"floci-io/floci","slug":"awsboolean-must-be-a-boolean-literal","errorCode":null,"errorMessage":"AWSBoolean must be a boolean literal","messagePattern":"AWSBoolean must be a boolean literal","errorType":"validation","errorClass":"CoercingParseLiteralException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java","lineNumber":287,"sourceCode":"    public static final GraphQLScalarType AWS_BOOLEAN = GraphQLScalarType.newScalar()\n        .name(\"AWSBoolean\")\n        .description(\"A boolean value\")\n        .coercing(new Coercing<Boolean, Boolean>() {\n            @Override\n            public Boolean serialize(Object dataFetcherResult) {\n                if (dataFetcherResult == null) return null;\n                if (dataFetcherResult instanceof Boolean b) return b;\n                throw new CoercingSerializeException(\"AWSBoolean cannot serialize non-boolean value: \" + dataFetcherResult.getClass().getSimpleName());\n            }\n            @Override\n            public Boolean parseValue(Object input) {\n                if (input instanceof Boolean b) return b;\n                throw new CoercingParseValueException(\"AWSBoolean cannot parse non-boolean value: \" + input);\n            }\n            @Override\n            public Boolean parseLiteral(Object input) {\n                if (input instanceof graphql.language.BooleanValue bv) return bv.isValue();\n                throw new CoercingParseLiteralException(\"AWSBoolean must be a boolean literal\");\n            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_LONG = GraphQLScalarType.newScalar()\n        .name(\"AWSLong\")\n        .description(\"A 64-bit signed integer\")\n        .coercing(new Coercing<Long, Long>() {\n            @Override\n            public Long serialize(Object dataFetcherResult) {\n                if (dataFetcherResult == null) return null;\n                if (dataFetcherResult instanceof Number n) return n.longValue();\n                return Long.parseLong(dataFetcherResult.toString());\n            }\n            @Override\n            public Long parseValue(Object input) {\n                if (input instanceof Number n) return n.longValue();\n                return Long.parseLong(input.toString());","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java#L269-L305","documentation":"Thrown by the AWSBoolean scalar's parseLiteral when the value written inline in the query document is not a BooleanValue literal. GraphQL's literal grammar distinguishes true/false keywords from quoted strings and numbers; only the bare keywords satisfy this scalar.","triggerScenarios":"A query document contains enable(flag: \"true\"), enable(flag: 1), or enable(flag: True) (capitalized) instead of enable(flag: true).","commonSituations":"Query string builders that quote all interpolations; porting JSON examples directly into query documents (JSON habits: quoting booleans); typos in hand-written documents (True/FALSE); codegen templates rendering booleans as strings.","solutions":["Write the bare literal: flag: true or flag: false — no quotes","Prefer passing the value as a $variable of type AWSBoolean over inline literals","Fix query-builder templates so booleans bypass the quoting path","Lint generated documents: AWSBoolean arguments must be true/false keywords"],"exampleFix":"# before\nmutation { enable(flag: \"true\") }\n\n# after\nmutation Enable($flag: AWSBoolean!) { enable(flag: $flag) }\n# variables: {\"flag\": true}","handlingStrategy":"type-guard","validationCode":"// Document generation: render booleans unquoted\nString literal = String.valueOf(b); // yields true/false keywords","typeGuard":"const rendersAsBooleanLiteral = (v: unknown): boolean => typeof v === 'boolean';","tryCatchPattern":"catch (CoercingParseLiteralException e) { // rewrite document: true/false without quotes, or move to a $variable }","preventionTips":["Use $variables for booleans instead of inline literals","Never quote true/false in documents","Guard template interpolators: strings quoted, booleans bare"],"tags":["graphql","appsync","awsboolean","parse-literal","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}