#json #schema #type #generate

json_schema

Generated types based on the JSON-Schema for json_schema

8 stable releases

Uses old Rust 2015

1.7.5 May 7, 2024
1.7.4 Apr 11, 2024
1.7.0 Oct 4, 2022
1.6.19 Jun 24, 2021
1.6.10 May 27, 2021

#71 in #types

Download history 13/week @ 2024-02-19 55/week @ 2024-02-26 5/week @ 2024-03-04 47/week @ 2024-03-11 8/week @ 2024-03-18 11/week @ 2024-03-25 82/week @ 2024-04-01 134/week @ 2024-04-08 43/week @ 2024-04-15 21/week @ 2024-04-22 7/week @ 2024-04-29 226/week @ 2024-05-06 21/week @ 2024-05-20

254 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