Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
bin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Readme.md

DEPRECATED

Try json-schema-merge-allof instead. It provides similar functionality to this libary, but does a merge that is semantic.

I deprecated this library because it contains bugs about how allOfs get merged in non-compliant ways. The alternative libary (json-schema-merge-allof) is much more thorough about producing compliant schemas after merge.

old docs

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}

About

DEPRECATED - Resolves `allof` references in JSON Schemas

Resources

License

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •