Join the DZone community and get the full member experience.
Join For Free
Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.
I'm happy to announce the very first release of my latest Erlang open source project,
jerg, a JSON Schema to Erlang Records Generator.
The objective of this project is to be a build tool that parses a rich domain model defined in JSON Schema (as specified in the
IETF Internet Draft
) in order to generate record definitions that can be used to Erlang applications to both read and write JSON.
I believe that having a formally defined object model for the data that's exchange over web resources is a major plus for APIs. It doesn't necessary imply that consumers have to generate static clients based on such a definition, but as far as the server is concerned, it raises the bar in term of consistency and opens the door for self-generated documentation.
doesn't deal with the actual mapping between JSON and records: there is already a library named
for that. It doesn't also deal with validation as, again, a library named
can take care of it.
This first version of
generates records with the appropriate type specification to enable type checking with
. It supports:
- cross-references for properties and collection items (ie the $ref property),
- default values,
- integer enumerations (other types can not be enumerated per limitation of the Erlang type specification).
It also supports a few extensions to JSON schema:
- extends: to allow a schema to extend another one in order to inherit all the properties of its parent (and any ancestors above it),
- abstract: to mark schemas that actually do not need to be output as records because they are just used through references and extension,
- recordName: to customize the name of the record generated from the concerned schema definition.
jerg has a few limitations, like its lack of support for embedded object schemas: pull-requests are more than welcome!
The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!