mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Merge branch 'split/develop/multiFileSupport' into feature/swagger20BundleSupport
This commit is contained in:
@@ -250,15 +250,6 @@ function isSwagger(version) {
|
||||
return compareVersion(version, VERSION_20.version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates if thew current input is using OAS 3.1 spec
|
||||
* @param {string} version The current spec version
|
||||
* @returns {boolean} True if the current spec is using OAS 3.1 spec
|
||||
*/
|
||||
function isOAS31(version) {
|
||||
return compareVersion(version, VERSION_31.version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if the input version is valid
|
||||
* @param {string} version The current spec version
|
||||
@@ -293,6 +284,7 @@ function getBundleRulesDataByVersion(version) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
getSpecVersion,
|
||||
getConcreteSchemaUtils,
|
||||
@@ -302,7 +294,6 @@ module.exports = {
|
||||
getVersionRegexBySpecificationVersion,
|
||||
SWAGGER_VERSION,
|
||||
VERSION_3_1,
|
||||
isOAS31,
|
||||
validateSupportedVersion,
|
||||
getBundleRulesDataByVersion
|
||||
};
|
||||
|
||||
@@ -12,7 +12,6 @@ const slashes = /\//g,
|
||||
resolveSecondLevelChild
|
||||
} = require('./bundleRules/resolvers');
|
||||
|
||||
|
||||
/**
|
||||
* Encodes a filepath name so it can be a json pointer
|
||||
* replaces tildes and slashes for ~0 and ~1
|
||||
|
||||
@@ -124,7 +124,8 @@ module.exports = {
|
||||
oasObject = obj.oasObject;
|
||||
}
|
||||
else {
|
||||
throw new Error(obj.reason);
|
||||
// Ignore this file.
|
||||
return;
|
||||
}
|
||||
if (inputValidation.validateSpec(oasObject, options).result) {
|
||||
if (specificationVersion) {
|
||||
|
||||
@@ -28,4 +28,4 @@ paths:
|
||||
type: string
|
||||
testNumber:
|
||||
type: integer
|
||||
- $ref: "./schemas/user.yaml"
|
||||
- $ref: "./schemas/user.yaml"
|
||||
|
||||
@@ -3,4 +3,4 @@ properties:
|
||||
petId:
|
||||
type: integer
|
||||
petName:
|
||||
type: string
|
||||
type: string
|
||||
|
||||
@@ -3,4 +3,4 @@ properties:
|
||||
id:
|
||||
type: integer
|
||||
userName:
|
||||
type: string
|
||||
type: string
|
||||
|
||||
@@ -26,5 +26,6 @@ paths:
|
||||
type: integer
|
||||
client:
|
||||
type: object
|
||||
not:
|
||||
$ref: "./schemas/user.yaml"
|
||||
not:
|
||||
$ref: "./schemas/user.yaml"
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@ properties:
|
||||
id:
|
||||
type: integer
|
||||
userName:
|
||||
type: string
|
||||
type: string
|
||||
|
||||
@@ -28,4 +28,4 @@ paths:
|
||||
type: string
|
||||
testNumber:
|
||||
type: integer
|
||||
- $ref: "./schemas/user.yaml"
|
||||
- $ref: "./schemas/user.yaml"
|
||||
|
||||
@@ -3,4 +3,4 @@ properties:
|
||||
petId:
|
||||
type: integer
|
||||
petName:
|
||||
type: string
|
||||
type: string
|
||||
|
||||
@@ -3,4 +3,4 @@ properties:
|
||||
id:
|
||||
type: integer
|
||||
userName:
|
||||
type: string
|
||||
type: string
|
||||
|
||||
@@ -1755,8 +1755,8 @@ describe('bundle files method - 3.0', function () {
|
||||
expect(JSON.stringify(res.output.data[0].bundledContent, null, 2)).to.be.equal(expected);
|
||||
});
|
||||
|
||||
it('Should bundle file from - additionalProperties 3.0', async function() {
|
||||
let contentRootFile = fs.readFileSync(additionalProperties + '/root.yaml', 'utf8'),
|
||||
it('Should bundle file from - additionalProperties', async function() {
|
||||
let contentRoot = fs.readFileSync(additionalProperties + '/root.yaml', 'utf8'),
|
||||
pet = fs.readFileSync(additionalProperties + '/pet.yaml', 'utf8'),
|
||||
additionalProps = fs.readFileSync(additionalProperties + '/additionalProperties.yaml', 'utf8'),
|
||||
expected = fs.readFileSync(additionalProperties + '/expected.json', 'utf8'),
|
||||
@@ -1771,7 +1771,7 @@ describe('bundle files method - 3.0', function () {
|
||||
data: [
|
||||
{
|
||||
path: '/root.yaml',
|
||||
content: contentRootFile
|
||||
content: contentRoot
|
||||
},
|
||||
{
|
||||
path: '/pet.yaml',
|
||||
@@ -1798,7 +1798,7 @@ describe('bundle files method - 3.0', function () {
|
||||
expected = fs.readFileSync(compositeOneOf + '/expected.json', 'utf8'),
|
||||
input = {
|
||||
type: 'multiFile',
|
||||
specificationVersion: '3.0.0',
|
||||
specificationVersion: '3.0',
|
||||
rootFiles: [
|
||||
{
|
||||
path: '/root.yaml'
|
||||
|
||||
Reference in New Issue
Block a user