#json #schema #type #generate

json_schema

Generated types based on the JSON-Schema for json_schema

7 stable releases

Uses old Rust 2015

new 1.7.4 Apr 11, 2024
1.7.0 Oct 4, 2022
1.6.19 Jun 24, 2021
1.6.18 Jun 18, 2021
1.6.10 May 27, 2021

#67 in #schema

Download history 30/week @ 2023-12-29 25/week @ 2024-01-05 16/week @ 2024-01-12 23/week @ 2024-01-26 3/week @ 2024-02-02 10/week @ 2024-02-16 39/week @ 2024-02-23 22/week @ 2024-03-01 16/week @ 2024-03-08 39/week @ 2024-03-15 7/week @ 2024-03-22 38/week @ 2024-03-29 140/week @ 2024-04-05

226 downloads per month

Apache-2.0

120KB
593 lines

JSON Schema Meta Schema

This repo contains the json schema meta schema and code to package it on npm, generate typings, etc.

Installing

Typescript

npm install --save @json-schema-tools/meta-schema

Golang

go get github.com/json-schema-tools/meta-schema

Rust

cargo install json_schema

Using

Typescript

import JSONSchema, { JSONSchemaObject, Properties, Items } from "@json-schema-tools/meta-schema"

Rust

From a string

let foo = r#"{
    "title": "helloworld",
    "type": "string"
}"#;

let as_json_schema: JSONSchemaObject = serde_json::from_str(foo).unwrap();

Using builder pattern

let schema = JSONSchemaObjectBuilder::default()
    .title("foobar".to_string())
    ._type(Type::SimpleTypes(SimpleTypes::String))
    .build()
    .unwrap();

let as_str = serde_json::to_string(&schema).unwrap();

Contributing

How to contribute, build and release are outlined in CONTRIBUTING.md, BUILDING.md and RELEASING.md respectively. Commits in this repository follow the CONVENTIONAL_COMMITS.md specification.

Dependencies

~1.2–2MB
~43K SLoC