Skip to content

Commit 4be806f

Browse files
committed
Merge branch 'develop' into fix/inputValidationNull
2 parents 67f5064 + 0a4393b commit 4be806f

File tree

391 files changed

+22729
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

391 files changed

+22729
-156
lines changed

.npmignore

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,16 @@ test/data/.temp
4343

4444
# Prevent unit test coverage reports from being added
4545
.coverage
46-
.nyc_output
46+
.nyc_output
47+
48+
# - Prevent config and test files from being added
49+
.git*
50+
.github/
51+
scripts/
52+
test/
53+
examples/
54+
.eslintrc
55+
.eslintignore
56+
.nycrc
57+
.editorconfig
58+
.jsdoc-config.json

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# OpenAPI-Postman Changelog
22

3+
#### v4.0.0 (July 12, 2022)
4+
* Added support for new multi-file API detectRootFiles() for OpenAPI 3 and Swagger 2 formats to support detection of root files among multiple files.
5+
* Added support for new multi-file API detectRelatedFiles() for OpenAPI 3 and Swagger 2 formats to support detection of related files for a provided root file amongst multiple files.
6+
* Added support for new multi-file API bundle() for OpenAPI 3 and Swagger 2 formats to support bundling of root files from provided multiple files.
7+
38
#### v3.2.0 (May 02, 2022)
49
* Fixed some of critical and high level severity vulnerabilities.
510
* Fixed issue [#10752](https://github.com/postmanlabs/postman-app-support/issues/10752) where deepObject style parameters were not generated correctly.

OPTIONS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ allowUrlPathVarMatching|boolean|-|false|Whether to allow matching path variables
2222
disableOptionalParameters|boolean|-|false|Whether to set optional parameters as disabled|CONVERSION
2323
keepImplicitHeaders|boolean|-|false|Whether to keep implicit headers from the OpenAPI specification, which are removed by default.|CONVERSION
2424
includeWebhooks|boolean|-|false|Select whether to include Webhooks in the generated collection|CONVERSION
25+
includeReferenceMap|boolean|-|false|Whether or not to include reference map or not as part of output|BUNDLE

assets/json-schema-faker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23782,7 +23782,7 @@ function extend() {
2378223782
var min = Math.max(params.minimum || 0, 0);
2378323783
var max = Math.min(params.maximum || Infinity, Infinity);
2378423784
min = handleExclusiveMinimum(schema, min);
23785-
max = handleExclusiveMaximum(schema, min);
23785+
max = handleExclusiveMaximum(schema, max);
2378623786
// discard out-of-bounds enumerations
2378723787
schema.enum = schema.enum.filter(function (x) {
2378823788
if (x >= min && x <= max) {

index.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

3-
const SchemaPack = require('./lib/schemapack.js').SchemaPack;
3+
const _ = require('lodash'),
4+
SchemaPack = require('./lib/schemapack.js').SchemaPack;
45

56
module.exports = {
67
// Old API wrapping the new API
@@ -32,6 +33,21 @@ module.exports = {
3233
return SchemaPack.getOptions(mode, criteria);
3334
},
3435

36+
detectRootFiles: async function(input) {
37+
var schema = new SchemaPack(input);
38+
return schema.detectRootFiles();
39+
},
40+
41+
detectRelatedFiles: async function(input) {
42+
var schema = new SchemaPack(input);
43+
return schema.detectRelatedFiles();
44+
},
45+
46+
bundle: async function(input) {
47+
var schema = new SchemaPack(input, _.has(input, 'options') ? input.options : {});
48+
return schema.bundle();
49+
},
50+
3551
// new API
3652
SchemaPack
3753
};

lib/30XUtils/inputValidation.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ module.exports = {
88
* @return {Object} Validation result
99
*/
1010
validateSpec: function (spec) {
11-
11+
if (_.isNil(spec)) {
12+
return {
13+
result: false,
14+
reason: 'The Specification is null or undefined'
15+
};
16+
}
1217
// Checking for the all the required properties in the specification
1318
if (_.isNil(spec.openapi)) {
1419
return {

lib/30XUtils/schemaUtils30X.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ module.exports = {
99
/**
1010
* Parses an OAS string/object as a YAML or JSON
1111
* @param {YAML/JSON} openApiSpec - The OAS 3.x specification specified in either YAML or JSON
12+
* @param {object} options - The parsing options
1213
* @returns {Object} - Contains the parsed JSON-version of the OAS spec, or an error
1314
* @no-unit-test
1415
*/
15-
parseSpec: function (openApiSpec) {
16-
return schemaUtilsCommon.parseSpec(openApiSpec, inputValidation30X);
16+
parseSpec: function (openApiSpec, options) {
17+
return schemaUtilsCommon.parseSpec(openApiSpec, inputValidation30X, options);
1718
},
1819

1920
/**

lib/31XUtils/inputValidation31X.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ module.exports = {
1111
*/
1212
validateSpec: function (spec, options) {
1313
const includeWebhooksOption = options.includeWebhooks;
14+
if (_.isNil(spec)) {
15+
return {
16+
result: false,
17+
reason: 'The Specification is null or undefined'
18+
};
19+
}
1420
if (_.isNil(spec.openapi)) {
1521
return {
1622
result: false,

0 commit comments

Comments
 (0)