From 6ee83a4426e286185575963f0eae9c1459d1655a Mon Sep 17 00:00:00 2001 From: Tom Sydney Kerckhove Date: Sat, 30 Oct 2021 20:38:08 +0200 Subject: [PATCH] strip the newlines off yaml encodings in the ValueSchema docs --- autodocodec-api-usage/test_resources/schema/example.txt | 4 ---- autodocodec-api-usage/test_resources/schema/fruit.txt | 4 ---- autodocodec-api-usage/test_resources/schema/ordering.txt | 3 --- autodocodec-yaml/src/Autodocodec/Yaml/Document.hs | 2 +- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/autodocodec-api-usage/test_resources/schema/example.txt b/autodocodec-api-usage/test_resources/schema/example.txt index 6ebadb5..98e55f1 100644 --- a/autodocodec-api-usage/test_resources/schema/example.txt +++ b/autodocodec-api-usage/test_resources/schema/example.txt @@ -25,11 +25,7 @@ fruit: # required # fruit!! [ Apple - , Orange - , Banana - , Melon - ] diff --git a/autodocodec-api-usage/test_resources/schema/fruit.txt b/autodocodec-api-usage/test_resources/schema/fruit.txt index d1bb8fa..d3865eb 100644 --- a/autodocodec-api-usage/test_resources/schema/fruit.txt +++ b/autodocodec-api-usage/test_resources/schema/fruit.txt @@ -1,9 +1,5 @@ [ Apple - , Orange - , Banana - , Melon - ] diff --git a/autodocodec-api-usage/test_resources/schema/ordering.txt b/autodocodec-api-usage/test_resources/schema/ordering.txt index 10cde25..da80147 100644 --- a/autodocodec-api-usage/test_resources/schema/ordering.txt +++ b/autodocodec-api-usage/test_resources/schema/ordering.txt @@ -1,7 +1,4 @@ [ LT - , EQ - , GT - ] diff --git a/autodocodec-yaml/src/Autodocodec/Yaml/Document.hs b/autodocodec-yaml/src/Autodocodec/Yaml/Document.hs index a16d7e1..8e7c8cc 100644 --- a/autodocodec-yaml/src/Autodocodec/Yaml/Document.hs +++ b/autodocodec-yaml/src/Autodocodec/Yaml/Document.hs @@ -65,7 +65,7 @@ jsonSchemaChunks = concatMap (\l -> l ++ ["\n"]) . (`evalState` S.empty) . go in if null s then pure [[""]] else concat <$> mapM (uncurry keySchemaFor) s - ValueSchema v -> pure [[chunk $ TE.decodeUtf8With TE.lenientDecode (Yaml.encode v)]] + ValueSchema v -> pure [[chunk $ T.strip $ TE.decodeUtf8With TE.lenientDecode (Yaml.encode v)]] ChoiceSchema s -> let addListAround = \case s_ :| [] -> do