bcp47-orphans 0.1.2.0 → 0.1.3.0
raw patch · 3 files changed
+57/−13 lines, 3 filesdep +lensdep +openapi3dep ~aesondep ~autodocodecdep ~esqueletoPVP ok
version bump matches the API change (PVP)
Dependencies added: lens, openapi3
Dependency ranges changed: aeson, autodocodec, esqueleto, hashable, hspec, persistent, serialise, text
API changes (from Hackage documentation)
+ Data.BCP47.OpenApi: instance Data.OpenApi.Internal.ParamSchema.ToParamSchema Data.BCP47.BCP47
+ Data.BCP47.OpenApi: instance Data.OpenApi.Internal.Schema.ToSchema Data.BCP47.BCP47
Files
- ChangeLog.md +6/−1
- bcp47-orphans.cabal +15/−12
- library/Data/BCP47/OpenApi.hs +36/−0
ChangeLog.md view
@@ -1,6 +1,11 @@-## [*Unreleased*](https://github.com/freckle/bcp47/compare/bcp47-orphans-v0.1.2.0...main)+## [*Unreleased*](https://github.com/freckle/bcp47/compare/bcp47-orphans-v0.1.3.0...main) None++## [v0.1.3.0](https://github.com/freckle/bcp47/compare/bcp47-orphans-v0.1.2.0...bcp47-orphans-v0.1.3.0)++- Add `ToSchema` and `ToParamSchema` instances for `BCP47`+- Drop support for GHC 8.6 ## [v0.1.2.0](https://github.com/freckle/bcp47/compare/bcp47-orphans-v0.1.1.0...bcp47-orphans-v0.1.2.0)
bcp47-orphans.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: bcp47-orphans-version: 0.1.2.0+version: 0.1.3.0 license: MIT license-file: LICENSE copyright: 2019 Freckle Education@@ -28,6 +28,7 @@ Data.BCP47.Esqueleto Data.BCP47.Hashable Data.BCP47.HttpApiData+ Data.BCP47.OpenApi Data.BCP47.PathPieces Data.BCP47.Persist Data.BCP47.Serialise@@ -36,19 +37,21 @@ other-modules: Paths_bcp47_orphans default-language: Haskell2010 build-depends:- aeson >=1.4.6.0,- autodocodec >=0.2.3.0,+ aeson >=1.4.7.1,+ autodocodec >=0.4.1.0, base >=4.7 && <5, bcp47 >=0.3.0.0, cassava >=0.5.2.0, errors >=2.3.0,- esqueleto >=3.0.0,- hashable >=1.2.7.0,+ esqueleto >=3.3.4.1,+ hashable >=1.3.0.0, http-api-data >=0.4.1.1,+ lens >=4.18.1,+ openapi3 >=3.2.4, path-pieces >=0.2.1,- persistent >=2.9.2,- serialise >=0.2.2.0,- text >=1.2.3.1+ persistent >=2.10.5.3,+ serialise >=0.2.3.0,+ text >=1.2.4.0 test-suite spec type: exitcode-stdio-1.0@@ -66,12 +69,12 @@ default-language: Haskell2010 build-depends: QuickCheck >=2.13.2,- aeson >=1.4.6.0,+ aeson >=1.4.7.1, base >=4.7 && <5, bcp47 >=0.3.0.0, bcp47-orphans, cassava >=0.5.2.0,- hspec >=2.7.1,+ hspec >=2.7.6, path-pieces >=0.2.1,- persistent >=2.9.2,- serialise >=0.2.2.0+ persistent >=2.10.5.3,+ serialise >=0.2.3.0
+ library/Data/BCP47/OpenApi.hs view
@@ -0,0 +1,36 @@+{-# LANGUAGE DerivingVia #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TypeApplications #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++module Data.BCP47.OpenApi () where++import Control.Lens ((&), (?~))+import Data.Aeson (Value (..))+import Data.BCP47+import Data.BCP47.Autodocodec ()+import Data.OpenApi+ ( NamedSchema (..)+ , OpenApiType (..)+ , ToParamSchema (..)+ , ToSchema (..)+ , description+ , example+ , format+ , toSchema+ , type_+ )+import Data.Proxy (Proxy (..))++instance ToSchema BCP47 where+ declareNamedSchema _ =+ pure+ $ NamedSchema (Just "BCP47")+ $ mempty+ & type_ ?~ OpenApiString+ & description ?~ "BCP47 language tag"+ & example ?~ String "en"+ & format ?~ "bcp47"++instance ToParamSchema BCP47 where+ toParamSchema _ = toSchema $ Proxy @BCP47