Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let oDepth = 0;
let blockDepth = 0;
let skipDepth = -1;
let container = [];
let depthQueue = new Map();
let block = { title: '', rows: [] };
if (schema) {
if (schema.title) block.title = schema.title;
if (!block.title && schema.description)
block.title = schema.description;
block.description = schema.description;
if (schema.externalDocs)
block.externalDocs = schema.externalDocs;
}
container.push(block);
let wsState = wsGetState();
wsState.combine = true;
wsState.allowRefSiblings = true;
walkSchema(schema,{},wsState,function(schema,parent,state){
let isBlock = false;
if (state.property && (state.property.startsWith('allOf') || state.property.startsWith('anyOf') || state.property.startsWith('oneOf') || (state.property === 'not'))) {
isBlock = true;
let components = (state.property+'/0').split('/');
if (components[1] !== '0') {
if (components[0] === 'allOf') components[0] = 'and';
if (components[0] === 'anyOf') components[0] = 'or';
if (components[0] === 'oneOf') components[0] = 'xor';
}
block = { title: components[0], rows: [] };
let dschema = schema;
let prefix = '';
function checkSchema(schema,parent,prop,openapi,options) {
let state = sw.getDefaultState();
state.openapi = openapi;
state.options = options;
state.property = prop;
sw.walkSchema(schema,parent,state,checkSubSchema);
}