json-spec-elm-servant 0.2.0.0 → 0.3.0.0
raw patch · 2 files changed
+37/−20 lines, 2 filesdep ~json-spec-elmPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: json-spec-elm
API changes (from Hackage documentation)
Files
json-spec-elm-servant.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: json-spec-elm-servant-version: 0.2.0.0+version: 0.3.0.0 synopsis: Generated elm code for servant APIs. description: Generate Elm encoders, decoders, and API requests for an Servant API, where the shape of the data@@ -30,7 +30,7 @@ , elm-syntax >= 0.3.2.0 && < 0.4 , http-types >= 0.12.3 && < 0.13 , json-spec >= 0.2.1.1 && < 0.3- , json-spec-elm >= 0.2.0.0 && < 0.3+ , json-spec-elm >= 0.3.0.0 && < 0.4 , mtl >= 2.2.2 && < 2.3 , prettyprinter >= 1.7.1 && < 1.8 , process >= 1.6.16.0 && < 1.7
src/Data/JsonSpec/Elm/Servant.hs view
@@ -72,10 +72,22 @@ , (Name.Field "url", "Basics.String") , (Name.Field "body", "Http.Body") , ( Name.Field "decoder"- , "Json.Decode.Decoder" `Type.App` Type.Var (B 0)+ , "Api.Req.Either"+ `Type.App` Type.Var (B 0)+ `Type.App` ("Json.Decode.Decoder" `Type.App` Type.Var (B 0)) ) ] )+ , Def.Type+ "Api.Req.Either"+ 2+ [ ( Name.Constructor "Left"+ , [toScope (Type.Var (B 0))]+ )+ , ( Name.Constructor "Right"+ , [toScope (Type.Var (B 1))]+ )+ ] , Def.Constant "Api.Req.task" 1@@ -147,21 +159,26 @@ [Pat.Var 0, Pat.Var 1] ( Expr.Case- (- Expr.apps- "Json.Decode.decodeString"- [ F . F <$>- p req "decoder"- , patVar 1- ]- )- [ pat "Result.Err" [Pat.Var 0] $- "Result.Err"- <| "Http.BadBody"- <| "Json.Decode.errorToString"- <| patVar 0- , pat "Result.Ok" [Pat.Var 0] $- "Result.Ok" <| patVar 0+ ( F . F <$> p req "decoder")+ [ pat "Api.Req.Left" [Pat.Var 0] $+ "Result.Ok" `Expr.App` patVar 0+ , pat "Api.Req.Right" [Pat.Var 0] $ + Expr.Case+ (+ Expr.apps+ "Json.Decode.decodeString"+ [ patVar 0+ , F <$> patVar 1+ ]+ )+ [ pat "Result.Err" [Pat.Var 0] $+ "Result.Err"+ <| "Http.BadBody"+ <| "Json.Decode.errorToString"+ <| patVar 0+ , pat "Result.Ok" [Pat.Var 0] $+ "Result.Ok" <| patVar 0+ ] ] ) ]@@ -212,7 +229,7 @@ requestFunctionBody params (reflectMethod (Proxy @method))- decoder+ ("Api.Req.Right" `Expr.App` decoder) ) pure () instance (ReflectMethod method) => Elmable (NoContentVerb method) where@@ -226,7 +243,7 @@ requestFunctionBody params (reflectMethod (Proxy @method))- (g "Json.Decode.succeed" `Expr.App` "Basics.()")+ ("Api.Req.Left" `Expr.App` "Basics.()") ) pure ()