1.0.10 • Published 4 years ago

jsonschematojson v1.0.10

Weekly downloads
2
License
ISC
Repository
-
Last release
4 years ago

JSON Schema Reference to Json

This package convert json schema reference into normalized json format

Installation

Use the package manager npm to install foobar.

npm install jsonschematojson

Usage of convertJsonSchemaRefToJson

const {convertJsonSchemaRefToJson}= require("jsonschematojson")

let sampleJsonschemaInput={"$schema":"","$id":"","title":"Sample","sampleData1Type":{"type":"string","enum":["test1","test2"]},"sampleData2Type":{"type":"object","required":["Test1","Test2"],"properties":{"Test1":{"type":"string"},"Test2":{"type":"string"}}},"Header":{"type":"object","required":["Name","Id","Designation"],"properties":{"Name":{"type":"string"},"Id":{"type":"string"},"Designation":{"type":"string"}}},"ItemType":{"type":"object","required":["creationDateTime","sampleData1","sampleData2","sampleData3"],"properties":{"creationDateTime":{"type":"string","format":"date-time"},"sampleData1":{"$ref":"#/sampleData1Type"},"sampleData2":{"$ref":"#/sampleData2Type"}}},"type":"object","required":["Header","item"],"properties":{"Header":{"$ref":"#/Header"},"item":{"type":"array","items":{"$ref":"#/ItemType"}}}}
let output=convertJsonSchemaRefToJson(sampleJsonschemaInput)

Output result:{"$schema":"","$id":"","title":"Sample","sampleData1Type":{"type":"string","enum":["test1","test2"]},"sampleData2Type":{"type":"object","required":["Test1","Test2"],"properties":{"Test1":{"type":"string"},"Test2":{"type":"string"}}},"Header":{"type":"object","required":["Name","Id","Designation"],"properties":{"Name":{"type":"string"},"Id":{"type":"string"},"Designation":{"type":"string"}}},"ItemType":{"type":"object","required":["creationDateTime","sampleData1","sampleData2","sampleData3"],"properties":{"creationDateTime":{"type":"string","format":"date-time"},"sampleData1":{"type":"string","enum":["test1","test2"]},"sampleData2":{"type":"object","required":["Test1","Test2"],"properties":{"Test1":{"type":"string"},"Test2":{"type":"string"}}}}},"type":"object","required":["Header","item"],"properties":{"Header":{"type":"object","required":["Name","Id","Designation"],"properties":{"Name":{"type":"string"},"Id":{"type":"string"},"Designation":{"type":"string"}}},"item":{"type":"array","items":{"type":"object","required":["creationDateTime","sampleData1","sampleData2","sampleData3"],"properties":{"creationDateTime":{"type":"string","format":"date-time"},"sampleData1":{"type":"string","enum":["test1","test2"]},"sampleData2":{"type":"object","required":["Test1","Test2"],"properties":{"Test1":{"type":"string"},"Test2":{"type":"string"}}}}}}}}

Usage of mapValueToKey with data access path

const {mapValueWithKey}= require("jsonschematojson")

let sampleJsonInput=
let output=convertJsonSchemaRefToJson(sampleJsonInput)

Output result:

Contributing

For major changes, please open an issue first to discuss what you would like to change.

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago