1.1.27 • Published 3 years ago

is-json-schema-subset v1.1.27

Weekly downloads
201
License
MIT
Repository
github
Last release
3 years ago

Build Status Greenkeeper badge Coverage Status

is-json-schema-subset

Check if a JSON schema is a subset of another

Given a schema defining the output of some process A, and a second schema defining the input of some process B, will the output from A be valid input for process B?

Uses ajv and json-schema-merge-allof.

Usage

import isJsonSchemaSubset from 'is-json-schema-subset';

import inputSchema from './input-schema.json';
import outputSchema from './input-schema.json';

async function check() {
	if (await isJsonSchemaSubset(inputSchema, outputSchema)) {
		console.log('OK');
	} else {
		console.log('Fail');
	}
}

API

import isJsonSchemaSubset from 'is-json-schema-subset';

isJsonSchemaSubset(subset: JSONSchema, superset: JSONSchema, allowPartial: boolean = false)

Returns a promise resolving to true if subset is a compatible subset of superset, else false.

If allowPartial is false, subset must provide all required properties for superset.

Install

$ yarn add is-json-schema-subset

Debugging

DEBUG=is-json-schema-subset ...

License

MIT

1.1.27

3 years ago

1.1.26

3 years ago

1.1.25

3 years ago

1.1.24

4 years ago

1.1.23

4 years ago

1.1.22

4 years ago

1.1.21

4 years ago

1.1.20

4 years ago

1.1.19

4 years ago

1.1.18

4 years ago

1.1.17

4 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago