mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
adding multifile swagger examples, adding tests to validate merging, merge and validate support for swagger 20
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user