json-schema-to-flow-type
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -123,2 +123,6 @@ 'use strict'; | ||
if (isObject(schema)) { | ||
return f.flowType('Object').props(_lodash2.default.mapValues(schema.properties, convertSchema), schema.required).union([..._lodash2.default.map(schema.patternProperties, convertSchema), typeof schema.additionalProperties === 'object' ? convertSchema(schema.additionalProperties) : undefined, typeof schema.additionalProperties === 'boolean' && schema.additionalProperties ? convertSchema({}) : undefined]); | ||
} | ||
if (isArray(schema)) { | ||
@@ -128,6 +132,2 @@ return f.flowType('Array').union(_lodash2.default.map([].concat(schema.items || {}), convertSchema)); | ||
if (isObject(schema)) { | ||
return f.flowType('Object').props(_lodash2.default.mapValues(schema.properties, convertSchema), schema.required).union([..._lodash2.default.map(schema.patternProperties, convertSchema), typeof schema.additionalProperties === 'object' ? convertSchema(schema.additionalProperties) : undefined, typeof schema.additionalProperties === 'boolean' && schema.additionalProperties ? convertSchema({}) : undefined]); | ||
} | ||
switch (_lodash2.default.toLower(String(schema.type))) { | ||
@@ -134,0 +134,0 @@ case 'string': |
@@ -38,3 +38,3 @@ 'use strict'; | ||
if (flowSchema.$required) { | ||
if (_lodash2.default.includes(flowSchema.$required, field)) { | ||
return ast; | ||
@@ -41,0 +41,0 @@ } |
{ | ||
"name": "json-schema-to-flow-type", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"ava": { | ||
@@ -15,3 +15,3 @@ "files": [ | ||
"lint": "eslint ./src --fix", | ||
"test": "ava", | ||
"test": "npm run lint && ava -v", | ||
"build": "rm -rf lib && babel src --ignore __**__ -d lib", | ||
@@ -23,3 +23,3 @@ "prepublish": "flow-typed update && npm test && npm run build" | ||
"@morlay/eslint-config": "3.0.x", | ||
"ava": "0.16.x", | ||
"ava": "0.17.x", | ||
"babel-cli": "6.18.x", | ||
@@ -26,0 +26,0 @@ "babel-core": "6.18.x", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13320