Giter VIP home page Giter VIP logo

servant-aeson-specs's Introduction

servant-aeson-specs

servant-aeson-specs allows you to generically obtain tests to make sure that the types you use in your servant applications can correctly be converted to JSON and read back to Haskell using aeson.

Backwards compatibility with 0.4.1

If you already have some golden files created by 0.4.1, there are two options to maintain backwards compatibility. You can either move the files into a directory called golden and set the sampleSize to 200:

apiGoldenSpecsWithSettings (defaultSettings { sampleSize = 200}) (Proxy :: Proxy SomeType)

or if you want to keep the golden files in golden.json you can do the following:

apiGoldenSpecsWithSettings (defaultSettings { goldenDirectoryOption = CustomDirectoryName "golden.json"
                                            , sampleSize = 200}) (Proxy :: Proxy SomeType)

servant-aeson-specs's People

Contributors

brendanhay avatar echatav avatar jkarni avatar mchaver avatar phadej avatar rocketpuppy avatar scott-fleischman avatar smurphy8 avatar soenkehahn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

servant-aeson-specs's Issues

servant 0.11?

Is there going to be an update that adds support for recent versions of servant?

add to stackage

Is there a plan to add servant-aeson-specs to stackage? It would be great!

Feature Request: Allow ignoring some instances.

There might be some instances that are used in only one direction in a given API. An example is login request bodies. I wouldn't want to give those a ToJSON instance to prevent accidental exposure of user credentials. It would be useful to ignore testing those instances instead of raising a compile time error as is done now.

I can look into what it would take to do this and open a PR, but my time is pretty limited at the moment.

Requires ToJSON instance for Headers

If I have an API that looks something like this:

type API = Post '[JSON] (Headers '[Header "Set-Cookie" ByteString] Int)

and a test like:

apiRoundTripSpecs (Proxy :: Proxy API)

I'm forced to provide a ToJSON instance for Headers '[Header "Set-Cookie" ByteString] Int. I would think that it should ignore the Headers and just test JSON conversion for Int.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.