Fixed [n] keys because they aren't actually arrays but represent net0-netn

This commit is contained in:
JanHolger 2020-12-28 10:16:23 +01:00
parent 7393ce4263
commit c13b05d2f8
2 changed files with 2774 additions and 188 deletions

View file

@ -69,15 +69,19 @@ function buildResponseSchema(source){
function parseInfo(path, method, info){
let id = generateOpId(method, path);
id = mapping[id] || id
let properties = (info.parameters && info.parameters.properties) ? Object.keys(info.parameters.properties).map(k => ({ name: k, ...info.parameters.properties[k] })) : []
const sourceProperties = (info.parameters && info.parameters.properties) ? Object.keys(info.parameters.properties).map(k => ({ name: k, ...info.parameters.properties[k] })) : []
properties = properties.map(p => {
if(p.type === 'string' && p.name.endsWith('[n]')){
p.items = JSON.parse(JSON.stringify(p))
p.type = 'array';
p.name = p.name.substr(0, p.name.length-3);
const properties = []
sourceProperties.forEach(p => {
if(p.name.endsWith('[n]')){
const nk = p.name.substr(0, p.name.length-3);
for(let i=0; i<30; i++){
properties.push({ ...JSON.parse(JSON.stringify(p)), name: nk+i })
}
}else{
properties.push(p)
}
return p;
});
const requestName = capitalizeFirst(id) + 'Request'

File diff suppressed because it is too large Load diff