![]() This was a bit tricky and I ended up breaking things down a lot and trying different path. This commit is the result of the most satisfying one. It introduces a new 'concept' and types: Definitions and Reference. These elements are meant to reflect JSON pointers and JSON-schema definitions which we now use for pretty much all user-defined data-types. In fact, Schemas are no longer inlined, but are always referencing some schema under "definitions". This indirection is necessary in order to cope with recursive types. And while it's only truly necessary for recursive types, using it consistently makes it both easier to produce and easier to consume. --- The blueprint generation for recursive types here also works thanks to the 'Definitions' data-structure wrapper around a BTreeMap. This uses a strategy where: (1) schemas are only generated if they haven't been seen before (2) schemas are marked as seen BEFORE actually being generated (to effectively stop a recursive generation). This relies on one important aspect: the key must be uniquely identifying a given schema. Which means that we have to monomorphize data-types with generic parameters also here, and use keys that are specialized in one data-type. --- In this large overhaul we've also lost one thing which I didn't bother re-introducing yet to keep the work manageable: title for record fields. Before, we use to pull those from record constructor when available, yet now, every record constructor has been replaced by a `$ref`. We could theoritically attach a title to the reference. I'll try to quickly add that in a later commit. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |
README.md
CLI
This is the crate that contains the aiken command line application which bundles together all the other crates in this project.
Install
cargo install aiken