Skip to content

Commit

Permalink
notice: use json-schema-to-yup package
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianmandrup committed Mar 21, 2019
1 parent a7c85ec commit af73fe6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 16 deletions.
12 changes: 10 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Build a Yup schema from a JSON Schema, GraphQL schema (type definition) or any other similar type/class and field/properties model or schema :)

## Important

Use the stable package [json-schema-to-yup](https://www.npmjs.com/package/json-schema-to-yup) for now.

We will fix the [schema-to-yup](https://www.npmjs.com/package/schema-to-yup) package shortly (moving to TypeScript, making architecture more pluggable etc).

## Schemas

- [AJV: JSON Schema keywords](https://ajv.js.org/keywords.html)
- [Learn JsonSchema](https://cswr.github.io/JsonSchema/)

Expand All @@ -15,7 +23,7 @@ According to the JSON schema specs, you are free to add extra metadata to the fi

Install

`npm install schema-to-yup -S` or `yarn add schema-to-yup`
`npm install json-schema-to-yup -S` or `yarn add json-schema-to-yup`

Use

Expand Down Expand Up @@ -69,7 +77,7 @@ const config = {
}
};

const { buildYup } = require("schema-to-yup");
const { buildYup } = require("json-schema-to-yup");
const yupSchema = buildYup(json, config);
// console.dir(schema)
const valid = await yupSchema.isValid({
Expand Down
45 changes: 32 additions & 13 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion test/convert.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { buildYup } = require("../");
const { buildYup } = require("../src");

var yup = require("yup");

Expand Down

0 comments on commit af73fe6

Please sign in to comment.