datatype-expansion
Advanced tools
Comparing version 0.2.3 to 0.2.4
{ | ||
"name": "datatype-expansion", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Utility tool to expand a given RAML type and create a canonical form", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -159,6 +159,6 @@ 'use strict' | ||
subType = superTypes.reduce((acc, val) => minType(val, acc), subType) | ||
return consistencyCheck(subType) | ||
return toCanonical(subType) | ||
} else { | ||
const superType = _.cloneDeep(form.type) | ||
const res = consistencyCheck(minType(superType, subType)) | ||
const superType = toCanonical(type) | ||
const res = minType(superType, subType) | ||
return toCanonical(res) | ||
@@ -165,0 +165,0 @@ } |
@@ -138,3 +138,3 @@ 'use strict' | ||
} else if (typeof form.type === 'string' && form.type in bindings) { | ||
if (form.properties !== undefined) form = expandObject(form, bindings, context.concat([form.type])) | ||
if (form.properties !== undefined) form = expandObject(form, bindings, context) | ||
form.type = expandForm(form.type, bindings, context) | ||
@@ -147,2 +147,3 @@ } else { | ||
if (form.properties !== undefined) form = expandObject(form, bindings, context) | ||
if (form.items !== undefined) form = expandArray(form, bindings, context) | ||
} else if (typeof form.type === 'object') { | ||
@@ -153,2 +154,3 @@ // 2.5. if `type` is a `Record` | ||
if (form.anyOf !== undefined) form = expandUnion(form, bindings, context) | ||
if (form.items !== undefined) form = expandArray(form, bindings, context) | ||
form.type = expandForm(form.type, bindings, context) | ||
@@ -155,0 +157,0 @@ } else { |
@@ -1102,3 +1102,33 @@ 'use strict' | ||
additionalProperties: true | ||
}, | ||
ParserNested: { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
required: true | ||
}, | ||
arr: { | ||
type: 'array', | ||
items: { | ||
type: 'string' | ||
}, | ||
required: true | ||
} | ||
}, | ||
additionalProperties: true | ||
}, | ||
CanonicalItemsTypeArray: { | ||
type: 'object', | ||
properties: { | ||
prop: { | ||
type: 'array', | ||
items: { | ||
type: 'string' | ||
}, | ||
required: true | ||
} | ||
}, | ||
additionalProperties: true | ||
} | ||
} |
@@ -236,3 +236,41 @@ 'use strict' | ||
device: { | ||
type: '$recur', | ||
anyOf: [ | ||
{ | ||
properties: { | ||
manufacturer: { | ||
type: 'string', | ||
required: true | ||
}, | ||
numberOfSIMCards: { | ||
type: 'number', | ||
required: true | ||
}, | ||
kind: { | ||
type: 'string', | ||
required: true | ||
} | ||
}, | ||
additionalProperties: true, | ||
type: 'object' | ||
}, | ||
{ | ||
properties: { | ||
manufacturer: { | ||
type: 'string', | ||
required: true | ||
}, | ||
numberOfUSBPorts: { | ||
type: 'number', | ||
required: true | ||
}, | ||
kind: { | ||
type: 'string', | ||
required: true | ||
} | ||
}, | ||
additionalProperties: true, | ||
type: 'object' | ||
} | ||
], | ||
type: 'union', | ||
required: true | ||
@@ -1233,3 +1271,54 @@ } | ||
additionalProperties: true | ||
}, | ||
ParserNested: { | ||
type: { | ||
type: [ | ||
{ | ||
type: 'object' | ||
} | ||
], | ||
properties: { | ||
name: { | ||
type: [ | ||
{ | ||
type: 'string' | ||
} | ||
], | ||
required: true | ||
} | ||
}, | ||
additionalProperties: true | ||
}, | ||
properties: { | ||
arr: { | ||
type: [ | ||
{ | ||
type: 'array' | ||
} | ||
], | ||
items: { | ||
type: 'string' | ||
}, | ||
required: true | ||
} | ||
}, | ||
additionalProperties: true | ||
}, | ||
CanonicalItemsTypeArray: { | ||
type: [{ | ||
type: 'object' | ||
}], | ||
properties: { | ||
prop: { | ||
type: 'array', | ||
items: { | ||
type: [{ | ||
type: 'string' | ||
}] | ||
}, | ||
required: true | ||
} | ||
}, | ||
additionalProperties: true | ||
} | ||
} |
@@ -571,3 +571,29 @@ 'use strict' | ||
} | ||
}, | ||
ParserNested: { | ||
type: { | ||
type: ['object'], | ||
properties: { | ||
name: { | ||
type: ['string'] | ||
} | ||
} | ||
}, | ||
properties: { | ||
arr: { | ||
type: ['array'], | ||
items: 'string' | ||
} | ||
} | ||
}, | ||
CanonicalItemsTypeArray: { | ||
type: ['object'], | ||
properties: { | ||
prop: { | ||
items: { | ||
type: ['string'] | ||
} | ||
} | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
926213
4211