json-spec-elm-servant 0.3.1.2 → 0.3.2.0
raw patch · 3 files changed
+25/−16 lines, 3 filesdep ~aesondep ~basedep ~bytestringPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: aeson, base, bytestring, containers, directory, elm-syntax, json-spec, json-spec-elm, mtl, process, servant, text
API changes (from Hackage documentation)
- Data.JsonSpec.Elm.Servant: class Elmable e
+ Data.JsonSpec.Elm.Servant: class Elmable (e :: k)
- Data.JsonSpec.Elm.Servant: class IsParam a
+ Data.JsonSpec.Elm.Servant: class IsParam (a :: k)
- Data.JsonSpec.Elm.Servant: servantDefs :: forall api. Elmable api => Proxy api -> Set Definition
+ Data.JsonSpec.Elm.Servant: servantDefs :: forall {k} (api :: k). Elmable api => Proxy api -> Set Definition
Files
- json-spec-elm-servant.cabal +13/−13
- src/Data/JsonSpec/Elm/Servant.hs +10/−2
- test/Api.hs +2/−1
json-spec-elm-servant.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: json-spec-elm-servant-version: 0.3.1.2+version: 0.3.2.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@@ -23,19 +23,19 @@ common dependencies build-depends:- , base >= 4.17.2.1 && < 4.20+ , base >= 4.19.0.0 && < 4.20 , bound >= 2.0.7 && < 2.1- , containers >= 0.6.7 && < 0.7- , directory >= 1.3.7.1 && < 1.4- , elm-syntax >= 0.3.2.0 && < 0.4+ , containers >= 0.6.8 && < 0.7+ , directory >= 1.3.8.1 && < 1.4+ , elm-syntax >= 0.3.3.0 && < 0.4 , http-types >= 0.12.3 && < 0.13- , json-spec >= 0.2.1.1 && < 0.3- , json-spec-elm >= 0.3.0.0 && < 0.4- , mtl >= 2.2.2 && < 2.4+ , json-spec >= 0.2.1.3 && < 0.3+ , json-spec-elm >= 0.3.0.4 && < 0.4+ , mtl >= 2.3.1 && < 2.4 , prettyprinter >= 1.7.1 && < 1.8- , process >= 1.6.16.0 && < 1.7- , servant >= 0.20 && < 0.21- , text >= 2.0.2 && < 2.2+ , process >= 1.6.18.0 && < 1.7+ , servant >= 0.20.1 && < 0.21+ , text >= 2.1 && < 2.2 , unordered-containers >= 0.2.19.1 && < 0.3 common warnings@@ -65,9 +65,9 @@ Api build-depends: , json-spec-elm-servant- , aeson >= 2.1.2.1 && < 2.2+ , aeson >= 2.2.1.0 && < 2.3 , binary >= 0.8.9.1 && < 0.9- , bytestring >= 0.11.4.0 && < 0.12+ , bytestring >= 0.12.0.2 && < 0.13 , cookie >= 0.4.6 && < 0.5 , hspec >= 2.11.1 && < 2.12 , time >= 1.12.2 && < 1.13
src/Data/JsonSpec/Elm/Servant.hs view
@@ -362,11 +362,19 @@ Text.toTitle <$> mapMaybe (\case- PathParam (Static segment) -> Just segment- PathParam (Capture name) -> Just name+ PathParam (Static segment) -> Just (munge segment)+ PathParam (Capture name) -> Just (munge name) _ -> Nothing ) params++ {-+ Try to generate valid names in the face of common api path+ idioms. It isn't really worth it for this to be complete, but we+ at least want to cover the basics+ -}+ munge :: Text -> Text+ munge = Text.replace "-" "_" requestFunctionType
test/Api.hs view
@@ -9,6 +9,7 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TypeAbstractions #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -126,7 +127,7 @@ :- "proposal" :> Capture "proposalId" ProposalId :> "invites"- :> "add"+ :> "add-invite" :> ReqBody' '[Required, Strict] '[JSON] Invite :> PostNoContent