The yesod-raml-mock package

[Tags:library, mit, test]

A mock-handler generator library from RAML.


[Skip to Readme]

Properties

Versions 0.1.0, 0.1.1
Change log ChangeLog.md
Dependencies base (==4.*), bytestring, containers, template-haskell, text, yaml, yesod-core, yesod-raml (==0.2.*) [details]
License MIT
Author junji.hashimoto
Maintainer junji.hashimoto@gmail.com
Category Web, Yesod
Bug tracker https://github.com/junjihashimoto/yesod-raml/issues
Source repository head: git clone https://github.com/junjihashimoto/yesod-raml.git
Uploaded Tue Nov 10 01:25:37 UTC 2015 by junjihashimoto
Distributions NixOS:0.1.1
Downloads 138 total (12 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2015-11-14 [all 2 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for yesod-raml-mock

Readme for yesod-raml-mock-0.1.1

Yesod-Raml-Mock:

Yesod-Raml-Mock makes mock-handler from example-tag of RAML File.

Usage

parseRamlMockFile makes mock-handler from RAML file. Example is below.

At first, write example-tag with media type.

title: Hoge API
baseUri: 'https://hoge/api/{version}'
version: v1
protocols: [ HTTPS ]
/user:
  /{String}:
    handler: HogeR
    get:
      description: hoger
      responses:
        200:
          body:
            application/json:
              example: '{ "test": "123" }'

Second, put parseRamlMockFile with RAML file.

$(parseRamlMockFile  "config/routes.raml")

This parseRamlMockFile makes following handler.

getHogeR :: Yesod app => String -> Handler app IO TypedContent
getHogeR _ = return $ TypedContent "application/json" "{ \"test\": \"123\" }"