yesod-raml-mock: A mock-handler generator library from RAML.

[ library, mit, web, yesod ] [ Propose Tags ] [ Report a vulnerability ]

A mock-handler generator library from RAML.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1
Change log ChangeLog.md
Dependencies base (>=4 && <5), bytestring, containers, template-haskell, text, yaml, yesod-core, yesod-raml (>=0.2 && <0.3) [details]
License MIT
Author junji.hashimoto
Maintainer junji.hashimoto@gmail.com
Category Web, Yesod
Bug tracker https://github.com/junjihashimoto/yesod-raml/issues
Source repo head: git clone https://github.com/junjihashimoto/yesod-raml.git
Uploaded by junjihashimoto at 2015-11-10T01:25:37Z
Distributions
Downloads 1336 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-11-14 [all 2 reports]

Readme for yesod-raml-mock-0.1.1

[back to package description]

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\" }"