Skip to content

Commit

Permalink
[sc-36080] Better error on non-string enum
Browse files Browse the repository at this point in the history
  • Loading branch information
ysangkok committed Apr 9, 2024
1 parent 9ff6be9 commit 6299da2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion json-fleece-openapi3/src/Fleece/OpenApi3.hs
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,12 @@ enumValueToText schema value =
case OA._schemaNullable schema of
Just True -> pure Nothing
_ -> CGU.codeGenError "null listed as enum value in a non-nullable schema"
_ -> CGU.codeGenError "Non-string value found for enum"
_ ->
CGU.codeGenError $
"Non-string value found for enum in schema titled '"
<> foldMap T.unpack (OA._schemaTitle schema)
<> "', value is: "
<> show value

mkOpenApiNumberFormat :: HC.TypeName -> OA.Schema -> CGU.CodeGen CGU.CodeGenDataFormat
mkOpenApiNumberFormat typeName schema = do
Expand Down

0 comments on commit 6299da2

Please sign in to comment.