Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tagsFiltered: (state, maxSize) => {
const version = state.application.version;
let endpoints = ObjectAssign({}, state.endpoints[version]);
endpoints = sortByOrder(endpoints);
let tags = [];
forEach(endpoints, endpoint => {
forEach(endpoint.tags || [], tag => {
tags.push(tag);
});
});
tags = unique(tags, (a, b) => {
return a === b;
});
let filterText = state.application.endpointTempFilterText;
filterText = filterText.replace(/ /g, ' ');// eslint-disable-line no-irregular-whitespace
filterText = filterText.replace(/,/g, ' ');
const targetTexts = filter((filterText || '').split(' '), targetText => {
return !!targetText;
});
if (!!targetTexts.length) {
tags = filter(tags, name => {
let isMatched = true;
'minLength',
'pattern',
'maxItems',
'minItems',
'uniqueItems',
'maxProperties',
'minProperties',
'required',
'enum',
//'type',// removed on purpose. type will be customized by dmc.
'items',
'allOf',
'properties',
'additionalProperties'
];
forEach(schemaObjectKeys, v => {
ret[`_${v}`] = schema[v];
ret[`get${v.charAt(0).toUpperCase()}${v.slice(1)}`] = function() {
return this[`_${v}`];
};
});
switch (type) {
case 'null':
ret._type = 'null';
ret._value = null;
ret._rawValue = null;
break;
case 'boolean':
ret._type = 'boolean';
ret._value = response;
ret._rawValue = response;
columns: (state, componentId) => {
const component = state.components[componentId];
// `table_labels` = 優先度が高いカラムkey群。
const tableLabels = component.def.table_labels || [];
// `sort` = ソート可能なkey群。
const sortableKeys = component.def.sort || [];
const columns = [];
forEach(component.columns, column => {
columns.push(ObjectAssign({}, column, {
isSortable: contains(sortableKeys, column.key)
}));
});
return sort(columns, (a, b) => {
let idxA = indexOf(tableLabels, a.key);
let idxB = indexOf(tableLabels, b.key);
if (idxA >= 0) {
idxA = tableLabels.length - idxA;
}
if (idxB >= 0) {
idxB = tableLabels.length - idxB;
}
return (idxB - idxA);
});
},
this.handleRowTap = e => {
const name = 'preview';
// プレビュー用に擬似的なParameterObjectsを作成する。
const properties = {};
forEach(this.columns, column => {
const property = deepClone(column);
const key = property.key;
delete property.key;
properties[key] = property;
});
const parameterObjects = [{
'in': 'body',
name,
schema: {
type: 'object',
properties
}
}];
// プレビュー用に擬似的なinitialValueを作成する。
const dataList = [];
forEach(this.data, data => {
this.getCurrentSearchRequestParametersForComponent = component => {
const parameterObjects = store.getter(getters.OAS_PARAMETER_OBJECTS, component.api.path, component.api.method);
const names = [];
forEach(parameterObjects, parameterObject => {
names.push(parameterObject.name);
});
return objectReject(this.currentSearchRequestParameters, (v, k) => {
return !contains(names, k);
});
};
// 現在の検索用パラメータ値をリセットします。
forEach(methods, method => {
const isOperationObjectDefined = !!state.oas.client.spec.paths[actionBasePath] && !!state.oas.client.spec.paths[actionBasePath][method];
if (!isOperationObjectDefined) {
return;
}
pathRefs.push({
path: actionBasePath,
method,
appendTo
});
});
});
// OperationObject群を抽出します。
const operationObjects = [];
forEach(pathRefs, ref => {
const operationObject = state.oas.client.spec.paths[ref.path][ref.method];
operationObjects.push(ObjectAssign({
operationObject
}, ref));
});
return operationObjects;
},
const _enum = (value, constraints) => {
const result = ObjectAssign({}, resultTemplate);
if (!hasOwn(constraints, 'enum')) {
return result;
}
const _enum = constraints.enum;
if (!isArray(_enum)) {
return result;
}
let isFound = false;
forEach(_enum, item => {
if (value === item) {
isFound = true;
}
});
if (!isFound) {
result.isValid = false;
result.message = `${JSON.stringify(_enum)}のいずれかの値を設定して下さい。`;
}
return result;
};
this.getRows = () => {
const rows = [];
forEach(this.opts.response, cells => {
const row = {};
forOwn(cells, (cell, key) => {
row[key] = cell;
});
rows.push(row);
});
return rows;
};
this.getSelectOptions = () => {
const options = [];
const enumDescriptions = formObject['x-enum-descriptions'] || {};
if (isUndefined(this.opts.val)) {
options.push({
label: '-- select an option --',
value: undefined,
isSelected: true,
isDiabled: true
});
}
forEach(formObject.enum, (v, idx) => {
options.push({
id: `select_${idx}`,
label: enumDescriptions[v] || v,
value: v,
isSelected: (v === this.opts.val)
});
});
return options;
};
this.getCrossSearchQueriesByDef = def => {
const ret = {};
forEach(def.query, query => {
ret[query.key] = this.crossSearchQueries[query.key];
});
return ret;
};