This project converts json Schema to the ZapierPlatform schema with zero runtime dependencies.
-
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' } ]
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 |
To run the test just use the yarn script:
yarn test
Just add a new tag via github or git tag
please use Semantic Versioning 2.0.0