2021-10-20 18:59:50 +03:00
|
|
|
# Autodocodec
|
|
|
|
|
|
|
|
Autodocodec is short for "self(auto)- documenting encoder and decoder".
|
|
|
|
|
2021-10-30 13:03:59 +03:00
|
|
|
In short:
|
|
|
|
You write one (1) instance, of the 'Codec' type-class, for your type, and you get:
|
|
|
|
|
|
|
|
* [A 'ToJSON' instance from 'aeson'](https://hackage.haskell.org/package/aeson-2.0.1.0/docs/Data-Aeson-Types.html#t:ToJSON)
|
|
|
|
* [A 'FromJSON' instance from 'aeson'](https://hackage.haskell.org/package/aeson-2.0.1.0/docs/Data-Aeson-Types.html#t:FromJSON)
|
|
|
|
* [A json schema](http://json-schema.org/)
|
|
|
|
* A human-readable yaml schema
|
|
|
|
* Hopefully soon also: A swagger schema
|
|
|
|
* Hopefully soon also: An openapi schema
|
|
|
|
* Potentially also: bson instances for mongodb
|
|
|
|
|
|
|
|
## DISCLAIMER: This is a work in progress.
|
|
|
|
|
|
|
|
This is not ready for production, it is not in use in any of my own projects yet, I do not recommend using it yet.
|
|
|
|
|
|
|
|
* Documentation is not complete.
|
|
|
|
* Some pieces of the implementation
|
|
|
|
|
2021-10-20 18:59:50 +03:00
|
|
|
## Goals:
|
|
|
|
|
|
|
|
* Correct-by-construction encoding and decoding, without generating code.
|
|
|
|
* Generate automatically-correct documentation from code.
|
|
|
|
* Fun but not important: Be able to provide instances without depending on aeson and/or yaml.
|
2021-10-20 19:23:55 +03:00
|
|
|
* Would be nice: support for recursive types.
|
2021-10-30 13:03:59 +03:00
|
|
|
|
|
|
|
|