reduced openapi spec file

This commit is contained in:
Dhroov Gupta
2019-08-30 14:56:18 +05:30
parent 39bdc8726f
commit e5c7afb8eb
4 changed files with 10 additions and 23 deletions

View File

@@ -164,19 +164,15 @@ module.exports = {
continue;
}
/* eslint-enable */
tempSchema.properties[prop] = property;
// eslint-disable-next-line max-len
tempSchema.properties[prop] = this.resolveRefs(tempSchema.properties[prop], bodyTypeOption, components, stack);
tempSchema.properties[prop] = this.resolveRefs(property,
bodyTypeOption, components, stack);
}
}
return tempSchema;
}
/* eslint-disable no-else-return */
else {
schema.type = 'string';
schema.default = '<object>';
}
/* eslint-enable */
schema.type = 'string';
schema.default = '<object>';
}
else if (schema.type === 'array' && schema.items) {

View File

@@ -1135,8 +1135,8 @@ module.exports = {
}
}
// eslint-disable-next-line max-len
bodyData = this.convertToPmBodyData(contentObj[bodyType], bodyType, BODY_TYPE.REQUEST, this.options.indentCharacter);
bodyData = this.convertToPmBodyData(contentObj[bodyType], bodyType,
BODY_TYPE.REQUEST, this.options.indentCharacter);
updateOptions = {
mode: rDataMode,

View File

@@ -21,17 +21,7 @@
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"readOnly": true
},
"tag": {
"type": "string",
"writeOnly": true
}
}
"$ref": "#/components/schemas/Pet"
}
}
}

View File

@@ -85,7 +85,8 @@ describe('CONVERT FUNCTION TESTS ', function() {
responseBody = conversionResult.output[0].data.item[0].item[0].response[0].body;
expect(err).to.be.null;
expect(requestBody).to.equal('{\n "name": "<string>",\n "tag": "<string>"\n}');
expect(responseBody).to.equal('[\n {\n "id": "<long>"\n },\n {\n "id": "<long>"\n }\n]');
expect(responseBody).to.equal('[\n {\n "id": "<long>",\n "name": "<string>"\n }' +
',\n {\n "id": "<long>",\n "name": "<string>"\n }\n]');
done();
});