json-schema-resolve-allof
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

JSON Schema Resolve Allof

Some simple code to resolve the allof references in JSON Schema

Usage

npm install json-schema-resolve-allof --save

Usage

var resolveAllOf = require('json-schema-resolve-allof');
 
resolveAllOf({
  "type": "string",
  "allOf": [{
      "properties": {
        "lastName": {
          "type": "string"
        }
      }
    },
    {
      "properties": {
        "lastName": {
          "type": "string"
        }
      }
    }
  ]
});
 
// Returns:
// {
//  "type": "string",
//  "properties": {
//    "lastName": {
//      "type": "string"
//    },
//    "lastName": {
//      "type": "string"
//    }
//  }
// }

Command Line Interface

json-schema-resolve-allof can also be used on the command line by piping stdin into it.

For example,

echo '{"allOf": [{"type": "object"}, {"additionalProperties": false}]}' | json-schema-resolve-allof

will return

{"type":"object","additionalProperties":false}

Readme

Keywords

Package Sidebar

Install

npm i json-schema-resolve-allof

Weekly Downloads

4,979

Version

1.5.0

License

ISC

Unpacked Size

73 kB

Total Files

20

Last publish

Collaborators

  • logvol