From 3be6c7babe6bd6a065fdec723392108b5c65bc44 Mon Sep 17 00:00:00 2001 From: Janus Troelsen Date: Tue, 9 Apr 2024 12:10:32 -0600 Subject: [PATCH] [sc-36080] Better error on non-string enum --- json-fleece-openapi3/src/Fleece/OpenApi3.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/json-fleece-openapi3/src/Fleece/OpenApi3.hs b/json-fleece-openapi3/src/Fleece/OpenApi3.hs index f43542d1..5354c675 100644 --- a/json-fleece-openapi3/src/Fleece/OpenApi3.hs +++ b/json-fleece-openapi3/src/Fleece/OpenApi3.hs @@ -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