0.3.0 • Published 2 years ago

jss-wasmbind v0.3.0

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
2 years ago

Json Schema Simplified

npm i jss-wasmbind

Example

Try online!

Build the schema

  • build from jss
import wasm from "jss-wasmbind";

const schema = wasm.jss`
/// A product in the catalog
schema Product: object {
    $schema: https://json-schema.org/draft/2020-12/schema
    $id: https://example.com/product.schema.json
    required: ["productId"]
}

/// The unique identifier for a product
properties productId: integer;
`
  • build from json

Check if the object satisfies the schema

// true
schema.isValid({
    productId: 1,
    productName: "A green door",
    price: 12.50,
    tags: ["home", "green"]
})
// false
schema.isValid([])

Find why the object does not satisfy the schema

schema.validate([])

Generate json schema for use with other json schema ecological libraries

schema.toJsonSchema()
0.3.0

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago