0.0
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Specify which objects your services publish or consume in MSON (markdown) and let this gem validate these contracts.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Lacerda Circle CI Coverage Status Code Climate Dependency Status Gem Version

«No, no -- we have to go on. We need total coverage.»1

This gem can:

  • convert MSON to JSON Schema files
  • read a directory which contains one directory per service
  • read a publish.mson and a consume.mson from each service
  • build a model of your infrastructure knowing
    • which services publishes what to which other service
    • which service consumes what from which other service
    • if all services consume and publish conforming to their contracts.

You likely don't want to use it on its own but integrate your infrastructure via

Zeta

. Click the link, it will explains things in more detail. If you're just looking for one way to transform MSON files into JSON Schema, read on:

MSON to JSON schema

Lacerda offers a rake task that converts MSON files into JSON schemas. To convert all *.mson files in contracts/ into *.schema.json files,

put this in your Rakefile:

require "lacerda/tasks"

and smoke it:

/home/dev/lacerda$ DATA_DIR=contracts/ rake lacerda:mson_to_json_schema
Converting 4 files:
OK /home/dev/lacerda/specifications/consumer/consume.mson
OK /home/dev/lacerda/specifications/invalid_property/consume.mson
OK /home/dev/lacerda/specifications/missing_required/consume.mson
OK /home/dev/lacerda/specifications/publisher/publish.mson
/home/dev/lacerda$

Structure

By loading all files in a directory this gem will build up the following relationships:

  • Infrastructure
    • Service
      • Contracts
        • Publish specification
          • PublishedObjects
        • Consume specification
          • ConsumedObjects

Compatibility

Until there is a native MSON to JSON schema parser available, we do the conversion ourselves. These features from the MSON specification are currently supported:

  • primitive properties: string, number, boolean, null
  • object properties
  • array properties with items of one type
  • array properties of mixed types
  • array properties of arrays
  • enum properties
  • One of properties mutually exclusive properties
  • Referencing
  • Mixins
  • Variable property names

Tests and development

  • run bundle once
  • run guard in a spare terminal which will run the tests, install gems, and so forth
  • run rspec spec to run all the tests
  • check out open coverage/index.html or open coverage/rcov/index.html
  • run bundle console to play around with a console

References

[1] This quote in French quotation marks is from "Fear and Loathing in Las Vegas". Since I can't link to the book, a link to the movie script shall suffice.