Merge pull request #146 from haskell-servant/pingu/0.4-bugfixes

Bugfix release
This commit is contained in:
Christian Marie 2015-07-09 11:52:13 +10:00
commit a67cbbc224
19 changed files with 73 additions and 24 deletions

View file

@ -16,7 +16,8 @@
set -o nounset set -o nounset
set -o errexit set -o errexit
. lib/common.sh DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
. "${DIR}/scripts/lib/common.sh"
usage () { usage () {
echo " bump-versions.sh <POSITION> [-d|--dry-run]" echo " bump-versions.sh <POSITION> [-d|--dry-run]"
@ -54,8 +55,11 @@ while [ "${1:-unset}" != "unset" ] ; do
done done
if $DRY_RUN ; then if $DRY_RUN ; then
bumper --dry-run -"$POSITION" $(join , "${SOURCES[@]}") echo "Would have bumped position ${POSITION} on these packages:"
( cd "$ROOT" && bumper --dry-run -"$POSITION" $(join , "${SOURCES[@]}") )
else else
bumper -"$POSITION" $(join , "${SOURCES[@]}") ( cd "$ROOT" && bumper -"$POSITION" $(join , "${SOURCES[@]}") )
fi fi
# Trailing newline, bumper does not ship with its own.
echo

View file

@ -11,6 +11,7 @@
DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )) DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
ROOT=$( dirname $DIR )
DRY_RUN=false DRY_RUN=false
POSITION="none" POSITION="none"
SOURCES_TXT="$( dirname $DIR)/sources.txt" SOURCES_TXT="$( dirname $DIR)/sources.txt"
@ -22,7 +23,7 @@ readarray -t SOURCES < "$SOURCES_TXT"
join () { local IFS="$1"; shift; echo "$*"; } join () { local IFS="$1"; shift; echo "$*"; }
versions_equal () { versions_equal () {
local NUM=$(find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l) local NUM=$(cd "$ROOT" && find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l)
if [ 1 -eq $NUM ] ; then if [ 1 -eq $NUM ] ; then
return 0 return 0
else else

View file

@ -2,7 +2,7 @@
-- documentation, see http://haskell.org/cabal/users-guide/ -- documentation, see http://haskell.org/cabal/users-guide/
name: servant-blaze name: servant-blaze
version: 0.4.2 version: 0.4.3
synopsis: Blaze-html support for servant synopsis: Blaze-html support for servant
-- description: -- description:
homepage: http://haskell-servant.github.io/ homepage: http://haskell-servant.github.io/

View file

@ -1,5 +1,5 @@
name: servant-client name: servant-client
version: 0.4.2 version: 0.4.3
synopsis: automatical derivation of querying functions for servant webservices synopsis: automatical derivation of querying functions for servant webservices
description: description:
This library lets you derive automatically Haskell functions that This library lets you derive automatically Haskell functions that

View file

@ -1,3 +1,7 @@
0.4.3
-----
* docsWith will no longer eat your documentation (https://github.com/haskell-servant/servant/pull/124)
0.4 0.4
--- ---
* `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body * `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body

View file

@ -1,5 +1,5 @@
name: servant-docs name: servant-docs
version: 0.4.2 version: 0.4.3
synopsis: generate API docs for your servant webservice synopsis: generate API docs for your servant webservice
description: description:
Library for generating API docs from a servant API definition. Library for generating API docs from a servant API definition.
@ -70,6 +70,7 @@ test-suite spec
base base
, aeson , aeson
, hspec , hspec
, lens
, servant , servant
, servant-docs , servant-docs
, string-conversions , string-conversions

View file

@ -338,7 +338,7 @@ extraInfo p action =
docsWith :: HasDocs layout => [DocIntro] -> ExtraInfo layout -> Proxy layout -> API docsWith :: HasDocs layout => [DocIntro] -> ExtraInfo layout -> Proxy layout -> API
docsWith intros (ExtraInfo endpoints) p = docsWith intros (ExtraInfo endpoints) p =
docs p & apiIntros <>~ intros docs p & apiIntros <>~ intros
& apiEndpoints %~ HM.unionWith combineAction endpoints & apiEndpoints %~ HM.unionWith (flip combineAction) endpoints
-- | Generate the docs for a given API that implements 'HasDocs' with with any -- | Generate the docs for a given API that implements 'HasDocs' with with any

View file

@ -7,7 +7,9 @@
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
module Servant.DocsSpec where module Servant.DocsSpec where
import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Monoid
import Data.Proxy import Data.Proxy
import Data.String.Conversions (cs) import Data.String.Conversions (cs)
import GHC.Generics import GHC.Generics
@ -21,7 +23,27 @@ spec = describe "Servant.Docs" $ do
describe "markdown" $ do describe "markdown" $ do
let md = markdown (docs (Proxy :: Proxy TestApi1)) let md = markdown (docs (Proxy :: Proxy TestApi1))
tests md
describe "markdown with extra info" $ do
let
extra = extraInfo
(Proxy :: Proxy (Get '[JSON, PlainText] Int))
(defAction & notes <>~ [DocNote "Get an Integer" ["get an integer in Json or plain text"]])
<>
extraInfo
(Proxy :: Proxy (ReqBody '[JSON] String :> Post '[JSON] Datatype1))
(defAction & notes <>~ [DocNote "Post data" ["Posts some Json data"]])
md = markdown (docsWith [] extra (Proxy :: Proxy TestApi1))
tests md
it "contains the extra info provided" $ do
md `shouldContain` "Get an Integer"
md `shouldContain` "Post data"
md `shouldContain` "get an integer in Json or plain text"
md `shouldContain` "Posts some Json data"
where
tests md = do
it "mentions supported content-types" $ do it "mentions supported content-types" $ do
md `shouldContain` "application/json" md `shouldContain` "application/json"
md `shouldContain` "text/plain;charset=utf-8" md `shouldContain` "text/plain;charset=utf-8"
@ -34,10 +56,11 @@ spec = describe "Servant.Docs" $ do
md `shouldContain` "POST" md `shouldContain` "POST"
md `shouldContain` "GET" md `shouldContain` "GET"
it "contains response samples" $ do it "contains response samples" $
md `shouldContain` "{\"dt1field1\":\"field 1\",\"dt1field2\":13}" md `shouldContain` "{\"dt1field1\":\"field 1\",\"dt1field2\":13}"
it "contains request body samples" $ do it "contains request body samples" $
md `shouldContain` "17" md `shouldContain` "17"
-- * APIs -- * APIs
data Datatype1 = Datatype1 { dt1field1 :: String data Datatype1 = Datatype1 { dt1field1 :: String

View file

@ -0,0 +1,3 @@
0.4.3
-----
* Clarify some variable names in the examples + semantic html pedantry

View file

@ -1,5 +1,5 @@
name: servant-examples name: servant-examples
version: 0.4.2 version: 0.4.3
synopsis: Example programs for servant synopsis: Example programs for servant
description: Example programs for servant, description: Example programs for servant,
showcasing solutions to common needs. showcasing solutions to common needs.

View file

@ -25,11 +25,11 @@ instance ToJSON Person
-- HTML serialization of a single person -- HTML serialization of a single person
instance ToHtml Person where instance ToHtml Person where
toHtml p = toHtml person =
tr_ $ do tr_ $ do
td_ (toHtml $ firstName p) td_ (toHtml $ firstName person)
td_ (toHtml $ lastName p) td_ (toHtml $ lastName person)
td_ (toHtml . show $ age p) td_ (toHtml . show $ age person)
toHtmlRaw = toHtml toHtmlRaw = toHtml
@ -37,9 +37,9 @@ instance ToHtml Person where
instance ToHtml [Person] where instance ToHtml [Person] where
toHtml persons = table_ $ do toHtml persons = table_ $ do
tr_ $ do tr_ $ do
td_ "first name" th_ "first name"
td_ "last name" th_ "last name"
td_ "age" th_ "age"
foldMap toHtml persons foldMap toHtml persons

View file

@ -1,3 +1,7 @@
0.4.3
-----
* Content type now set to JSON when a request body is sent (#122)
0.4 0.4
--- ---
* `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body * `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body

View file

@ -1,5 +1,5 @@
name: servant-jquery name: servant-jquery
version: 0.4.2 version: 0.4.3
synopsis: Automatically derive (jquery) javascript functions to query servant webservices synopsis: Automatically derive (jquery) javascript functions to query servant webservices
description: description:
Automatically derive jquery-based javascript functions to query servant webservices. Automatically derive jquery-based javascript functions to query servant webservices.

View file

@ -65,13 +65,14 @@ generateJS req = "\n" <>
dataBody = dataBody =
if req ^. reqBody if req ^. reqBody
then "\n , data: JSON.stringify(body)\n" then " , data: JSON.stringify(body)\n" <>
" , contentType: 'application/json'\n"
else "" else ""
reqheaders = reqheaders =
if null hs if null hs
then "" then ""
else "\n , headers: { " ++ headersStr ++ " }\n" else " , headers: { " ++ headersStr ++ " }\n"
where headersStr = intercalate ", " $ map headerStr hs where headersStr = intercalate ", " $ map headerStr hs
headerStr header = "\"" ++ headerStr header = "\"" ++

View file

@ -2,7 +2,7 @@
-- documentation, see http://haskell.org/cabal/users-guide/ -- documentation, see http://haskell.org/cabal/users-guide/
name: servant-lucid name: servant-lucid
version: 0.4.2 version: 0.4.3
synopsis: Servant support for lucid synopsis: Servant support for lucid
-- description: -- description:
homepage: http://haskell-servant.github.io/ homepage: http://haskell-servant.github.io/

View file

@ -1,5 +1,5 @@
name: servant-server name: servant-server
version: 0.4.2 version: 0.4.3
synopsis: A family of combinators for defining webservices APIs and serving them synopsis: A family of combinators for defining webservices APIs and serving them
description: description:
A family of combinators for defining webservices APIs and serving them A family of combinators for defining webservices APIs and serving them

View file

@ -1,3 +1,7 @@
0.4.3
-----
* Add missing HasLink instance for Header (https://github.com/haskell-servant/servant/issues/128)
0.4.1 0.4.1
----- -----
* Allow whitespace after parsing JSON * Allow whitespace after parsing JSON

View file

@ -1,5 +1,5 @@
name: servant name: servant
version: 0.4.2 version: 0.4.3
synopsis: A family of combinators for defining webservices APIs synopsis: A family of combinators for defining webservices APIs
description: description:
A family of combinators for defining webservices APIs and serving them A family of combinators for defining webservices APIs and serving them

View file

@ -339,6 +339,10 @@ instance (ToText v, HasLink sub)
toLink (Proxy :: Proxy sub) $ toLink (Proxy :: Proxy sub) $
addSegment (escape . unpack $ toText v) l addSegment (escape . unpack $ toText v) l
instance HasLink sub => HasLink (Header sym a :> sub) where
type MkLink (Header sym a :> sub) = MkLink sub
toLink _ = toLink (Proxy :: Proxy sub)
-- Verb (terminal) instances -- Verb (terminal) instances
instance HasLink (Get y r) where instance HasLink (Get y r) where
type MkLink (Get y r) = URI type MkLink (Get y r) = URI