adding multifile swagger examples, adding tests to validate merging, merge and validate support for swagger 20

This commit is contained in:
Erik Mendoza
2022-04-19 19:33:26 -05:00
parent 90a191dc4c
commit ae43c43f6f
29 changed files with 661 additions and 5 deletions

View File

@@ -4,9 +4,10 @@ module.exports = {
/**
* Validate Spec to check if some of the required fields are present.
* @param {Object} spec OpenAPI spec
* @param {object} options Validation options
* @return {Object} Validation result
*/
validateSpec: function (spec) {
validateSpec: function (spec, options) {
if (spec.swagger !== '2.0') {
return {
result: false,
@@ -19,7 +20,7 @@ module.exports = {
reason: 'The Swagger object must have an "info" property'
};
}
if (!(spec.info.title && spec.info.version)) {
if (!(spec.info.title && spec.info.version) && !options.isFolder) {
return {
result: false,
reason: 'The info property must have title and version defined'