json-spec 0.2.0.0 → 0.2.1.0
raw patch · 2 files changed
+12/−8 lines, 2 filesdep +containersdep −lensdep −openapi3dep ~aesonPVP ok
version bump matches the API change (PVP)
Dependencies added: containers
Dependencies removed: lens, openapi3
Dependency ranges changed: aeson
API changes (from Hackage documentation)
Files
- json-spec.cabal +5/−6
- src/Data/JsonSpec/Encode.hs +7/−2
json-spec.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: json-spec-version: 0.2.0.0+version: 0.2.1.0 synopsis: Type-level JSON specification maintainer: rick@owensmurray.com description: = Motivation@@ -116,11 +116,9 @@ common dependencies build-depends:- , aeson >= 2.1.2.1 && < 2.2+ , aeson >= 2.2.0.0 && < 2.3 , base >= 4.17.1.0 && < 4.18- , bytestring >= 0.11.4.0 && < 0.12- , lens >= 5.2.2 && < 5.3- , openapi3 >= 3.2.3 && < 3.3+ , containers >= 0.6.7 && < 0.7 , scientific >= 0.3.7.0 && < 0.4 , text >= 2.0.2 && < 2.1 , time >= 1.12.2 && < 1.13@@ -154,4 +152,5 @@ default-language: Haskell2010 build-depends: , json-spec- , hspec >= 2.11.1 && < 2.12+ , bytestring >= 0.11.4.0 && < 0.12+ , hspec >= 2.11.1 && < 2.12
src/Data/JsonSpec/Encode.hs view
@@ -15,9 +15,10 @@ import Data.Aeson (ToJSON(toJSON), Value)-import Data.JsonSpec.Spec (Field(Field), Rec(unRec), JSONStructure,- JStruct, Specification, Tag, sym)+import Data.JsonSpec.Spec (Field(Field), Rec(unRec),+ Specification(JsonArray), JSONStructure, JStruct, Tag, sym) import Data.Scientific (Scientific)+import Data.Set (Set) import Data.Text (Text) import Data.Time (UTCTime) import GHC.TypeLits (KnownSymbol)@@ -25,6 +26,7 @@ (.), Int, Maybe, maybe) import qualified Data.Aeson as A import qualified Data.Aeson.KeyMap as KM+import qualified Data.Set as Set {- |@@ -37,6 +39,9 @@ {- | Encode the value into the structure appropriate for the specification. -} toJSONStructure :: a -> JSONStructure (EncodingSpec a)+instance (HasJsonEncodingSpec a) => HasJsonEncodingSpec (Set a) where+ type EncodingSpec (Set a) = JsonArray (EncodingSpec a)+ toJSONStructure = fmap toJSONStructure . Set.toList {- |