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 errexit
. lib/common.sh
DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
. "${DIR}/scripts/lib/common.sh"
usage () {
echo " bump-versions.sh <POSITION> [-d|--dry-run]"
@ -54,8 +55,11 @@ while [ "${1:-unset}" != "unset" ] ; do
done
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
bumper -"$POSITION" $(join , "${SOURCES[@]}")
( cd "$ROOT" && bumper -"$POSITION" $(join , "${SOURCES[@]}") )
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 ))
ROOT=$( dirname $DIR )
DRY_RUN=false
POSITION="none"
SOURCES_TXT="$( dirname $DIR)/sources.txt"
@ -22,7 +23,7 @@ readarray -t SOURCES < "$SOURCES_TXT"
join () { local IFS="$1"; shift; echo "$*"; }
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
return 0
else

View File

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

View File

@ -1,5 +1,5 @@
name: servant-client
version: 0.4.2
version: 0.4.3
synopsis: automatical derivation of querying functions for servant webservices
description:
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
---
* `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body

View File

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

View File

@ -338,7 +338,7 @@ extraInfo p action =
docsWith :: HasDocs layout => [DocIntro] -> ExtraInfo layout -> Proxy layout -> API
docsWith intros (ExtraInfo endpoints) p =
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

View File

@ -7,7 +7,9 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Servant.DocsSpec where
import Control.Lens
import Data.Aeson
import Data.Monoid
import Data.Proxy
import Data.String.Conversions (cs)
import GHC.Generics
@ -21,7 +23,27 @@ spec = describe "Servant.Docs" $ do
describe "markdown" $ do
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
md `shouldContain` "application/json"
md `shouldContain` "text/plain;charset=utf-8"
@ -34,10 +56,11 @@ spec = describe "Servant.Docs" $ do
md `shouldContain` "POST"
md `shouldContain` "GET"
it "contains response samples" $ do
it "contains response samples" $
md `shouldContain` "{\"dt1field1\":\"field 1\",\"dt1field2\":13}"
it "contains request body samples" $ do
it "contains request body samples" $
md `shouldContain` "17"
-- * APIs
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
version: 0.4.2
version: 0.4.3
synopsis: Example programs for servant
description: Example programs for servant,
showcasing solutions to common needs.

View File

@ -25,11 +25,11 @@ instance ToJSON Person
-- HTML serialization of a single person
instance ToHtml Person where
toHtml p =
toHtml person =
tr_ $ do
td_ (toHtml $ firstName p)
td_ (toHtml $ lastName p)
td_ (toHtml . show $ age p)
td_ (toHtml $ firstName person)
td_ (toHtml $ lastName person)
td_ (toHtml . show $ age person)
toHtmlRaw = toHtml
@ -37,9 +37,9 @@ instance ToHtml Person where
instance ToHtml [Person] where
toHtml persons = table_ $ do
tr_ $ do
td_ "first name"
td_ "last name"
td_ "age"
th_ "first name"
th_ "last name"
th_ "age"
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
---
* `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
name: servant-server
version: 0.4.2
version: 0.4.3
synopsis: A family of combinators for defining webservices APIs and serving them
description:
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
-----
* Allow whitespace after parsing JSON

View File

@ -1,5 +1,5 @@
name: servant
version: 0.4.2
version: 0.4.3
synopsis: A family of combinators for defining webservices APIs
description:
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) $
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
instance HasLink (Get y r) where
type MkLink (Get y r) = URI