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 3be6c7b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 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,16 @@ 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
<> ", enums options are "
<> show (OA._schemaEnum schema)
<> ", description is "
<> show (OA._schemaDescription schema)

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

0 comments on commit 3be6c7b

Please sign in to comment.