zapier-platform-json-schema
v0.4.9
Published
Lib to convert JSON-Schema to zapier schema
Downloads
4,267
Readme
Zapier Platform JSON Schema
This project converts json Schema to the ZapierPlatform schema with zero runtime dependencies.
Getting started
npm install zapier-platform-json-schema --save
yarn add zapier-platform-json-schema
const {default: ZapierSchemaBuilder} = require ("zapier-platform-json-schema");
const schema = {
"type": "object",
"properties": {
"stringProp": {
"type": "string"
},
"excludedProp": {
"type": "string"
},
},
};
console.log(new ZapierSchemaBuilder(schema)
.addExclude("excludedProp")
.build());
// prints: [ { key: 'stringProp', type: 'string' } ]
Features
The following list summarize the current scope and supported features of this lib.
| Feature | Status | Comment| | ------------- |:-------------:| -----:| | strings | ✅ | Example | | boolean | ✅ | Example | | datetime | ✅ | Example | | enum | ✅ | Example | | array of enum | ✅ | Example | | array | ✅ | | | anyOf | ✅ | | | anyOf prefer non-string | ✅ | Example | | $ref to external| ❌ | | | $ref to object| ✅ | Example | | $ref to enum | ✅ | Example | | get nested defeintion | ✅ | Example | | Additional props | ✅ | Example | | required | ✅ | Example | | label | ✅ | Example |
Test
To run the test just use the yarn script:
yarn test
Release
Just add a new tag via github or git tag
please use Semantic Versioning 2.0.0