apiaryio / api-elements

API Elements is a structure for describing APIs and the complex data structures used within them.
http://apielements.org/
MIT License
28 stars 10 forks source link

Fix example code blocks that have invalid refract serialisation #56

Closed kylef closed 5 years ago

kylef commented 5 years ago

Spotted some examples that we're incorrect so I've written some checks to parse the JSON examples and validate them against a schema.

Using pytest, I've used paramatised tests to invoke the test for each markdown file in the repo. Then used commonmark to parse the markdown file into AST, traversed the AST for code blocks and then validated the ones that are JSON as Refract. The schema is not created here, it is already reviewed and from https://github.com/refractproject/refract-spec/blob/061ebe58af83f0cca84f33c69fb22f654826ef06/formats/json-refract-schema.json, I realise it probably doesn't belong there anymore, welcome to any suggestions on some alternative structure.