Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add if then else support #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
language: node_js
after_success: npm run coverage
node_js:
- 10
- 12
- 14
- node
- lts/*
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ When multiple conflicting **not** values are found, we also use the approach tha

Allows you to combine schema properties even though some schemas have `additionalProperties: false` This is the most common issue people face when trying to expand schemas using allOf and a limitation of the json schema spec. Be aware though that the schema produced will allow more than the original schema. But this is useful if just want to combine schemas using allOf as if additionalProperties wasn't false during the merge process. The resulting schema will still get additionalProperties set to false.

**deep** boolean, default *true*
If false, resolves only the top-level `allOf` keyword in the schema.

If true, resolves all `allOf` keywords in the schema.


**resolvers** Object
Override any default resolver like this:

Expand All @@ -92,11 +98,6 @@ mergeAllOf(schema, {
})
```

**deep** boolean, default *true*
If false, resolves only the top-level `allOf` keyword in the schema.

If true, resolves all `allOf` keywords in the schema.

The function is passed:

- **values** an array of the conflicting values that need to be resolved
Expand All @@ -121,7 +122,7 @@ Those two resolvers are expected to return an object containing the resolved val
Also the resolve function is not passed **mergeSchemas**, but an object **mergers** that contains mergers for each of the related keywords. So properties get passed an object like this:

```js
var mergers = {
const mergers = {
properties: function mergeSchemas(schemas, childSchemaName){...},
patternProperties: function mergeSchemas(schemas, childSchemaName){...},
additionalProperties: function mergeSchemas(schemas){...},
Expand Down
Loading