Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
jsonschema-transpiler
A tool for transpiling JSON Schema into schemas for Avro and BigQuery.
JSON Schema is primarily used to validate incoming data, but contains enough information to describe the structure of the data. The transpiler encodes the schema for use with data serialization and processing frameworks. The main use-case is to enable ingestion of JSON documents into BigQuery through an Avro intermediary.
This tool can handle many of the composite types seen in modern data processing tools that support a SQL interface such as lists, structures, key-value maps, and type-variants.
This tool is designed for generating new schemas from
mozilla-pipeline-schemas
,
the canonical source of truth for JSON schemas in the Firefox Data Platform.
Installation
Usage
)
JSON Schemas can be read from stdin or from a file.
Examples usage
# An object with a single, optional boolean field
|
{
}
|
{
{
{
}
{
}
}
}
|
[
{
}
Building
To build and test the package:
Older versions of the package (<= 1.9) relied on the use of oniguruma for performing snake-casing logic. To enable the use of this module, add a feature flag:
Contributing
Contributions are welcome. The API may change significantly, but the
transformation between various source formats should remain consistent. To aid
in the development of the transpiler, tests cases are generated from a language
agnostic format under tests/resources
.
Schemas provide a type system for data-structures. Most schema languages support a similar set of primitives. There are atomic data types like booleans, integers, and floats. These atomic data types can form compound units of structure, such as objects, arrays, and maps. The absence of a value is usually denoted by a null type. There are type modifiers, like the union of two types.
The following schemas are currently supported:
- JSON Schema
- Avro
- BigQuery
In the future, it may be possible to support schemas from similar systems like Parquet and Spark, or into various interactive data languages (IDL) like Avro IDL.
Publishing
The jsonschema-transpiler is distributed as a crate via Cargo. Follow this checklist for deploying to crates.io.
- Bump the version number in the
Cargo.toml
, as per Semantic Versioning. - Double check that
cargo test
and CI succeeds. - Run
cargo publish
. It must be run with the--no-verify
flag due to issue #59. - Draft a new release in GitHub corresponding with the version bump.