Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build
docs
.DS_Store
dist
target
87 changes: 86 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,40 @@ This repo contains the json schema meta schema and code to package it on npm, ge

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


### Rust

`cargo install json_schema`

## Using

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

###
### Rust

#### From a string
```rust
let foo = r#"{
"title": "helloworld",
"type": "string"
}"#;

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

#### Using builder pattern
```rust
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

Expand Down
Loading