Skip to content

Commit

Permalink
Merge pull request #86 from postmanlabs/release/v0.3.0
Browse files Browse the repository at this point in the history
Release version v0.3.0
  • Loading branch information
VShingala committed Jun 7, 2024
2 parents 230e74b + b3e6ec0 commit 043a63b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 155 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [v0.3.0] - 2024-06-07

### Fixed

- Removed usage of archived webapi-parser for error reporting causing issues with app bundling.

## [v0.2.0] - 2024-02-15

### Added
Expand Down Expand Up @@ -65,7 +71,9 @@ Newer releases follow the [Keep a Changelog](https://keepachangelog.com/en/1.0.0

- Base release

[Unreleased]: https://github.com/postmanlabs/raml1-to-postman/compare/v0.2.0...HEAD
[Unreleased]: https://github.com/postmanlabs/raml1-to-postman/compare/v0.3.0...HEAD

[v0.3.0]: https://github.com/postmanlabs/raml1-to-postman/compare/v0.2.0...v0.3.0

[v0.2.0]: https://github.com/postmanlabs/raml1-to-postman/compare/v0.1.8...v0.2.0

Expand Down
59 changes: 36 additions & 23 deletions lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const raml = require('./../assets/raml-1-parser'),
helper = require('./helper.js'),
getOptions = require('./options').getOptions,
{ Node, Trie } = require('./trie.js'),
{ generateError } = require('./generateError.js'),
UserError = require('./UserError'),

// This is the default collection name if one can't be inferred from the RAML 1.0 spec
COLLECTION_NAME = 'Converted from RAML 1.0';
Expand Down Expand Up @@ -169,31 +169,43 @@ var converter = {

let collection = new SDK.Collection(),
content = browser ? fileDataResolver : fileResolver,
ramlAPI,
ramlJSON,
convertedBaseUrl,
trie,
info,
rootParameters,
resourceTypes;

try {
ramlAPI = raml.parseRAMLSync(ramlString, {
fsResolver: {
rootFilePath: files.rootFilePath || '',
allFilePaths: _.isArray(files.allFilePaths) ? _.map(files.allFilePaths, 'fileName') : [],
content: content
}
}),
ramlJSON = ramlAPI.toJSON(),
convertedBaseUrl,
trie,
info = {
title: _.get(ramlJSON, 'title', COLLECTION_NAME),
documentation: _.get(ramlJSON, 'documentation', ''),
description: _.get(ramlJSON, 'description', ''),
version: _.get(ramlJSON, 'version', '')
},
rootParameters = {
types: '',
traits: '',
baseUri: ramlJSON.baseUri,
baseUriParameters: ramlJSON.baseUriParameters,
securitySchemes: '',
securedBy: _.get(ramlJSON, 'securedBy', '')
},
resourceTypes = _.get(ramlJSON, 'resourceTypes', {});
});
}
catch (error) {
return cb(new UserError('Provided RAML 1.0 definition is invalid.', error));
}

ramlJSON = ramlAPI.toJSON();
info = {
title: _.get(ramlJSON, 'title', COLLECTION_NAME),
documentation: _.get(ramlJSON, 'documentation', ''),
description: _.get(ramlJSON, 'description', ''),
version: _.get(ramlJSON, 'version', '')
};
rootParameters = {
types: '',
traits: '',
baseUri: ramlJSON.baseUri,
baseUriParameters: ramlJSON.baseUriParameters,
securitySchemes: '',
securedBy: _.get(ramlJSON, 'securedBy', '')
};
resourceTypes = _.get(ramlJSON, 'resourceTypes', {});

// Assign default options.
options = overrideOptions(options);
Expand Down Expand Up @@ -251,9 +263,10 @@ var converter = {
}]
});
}
catch (originalError) {
return generateError(ramlString, originalError, (constructedError) => {
return cb(constructedError);
catch (e) {
return cb(null, {
result: false,
reason: e.toString()
});
}

Expand Down
46 changes: 0 additions & 46 deletions lib/generateError.js

This file was deleted.

89 changes: 7 additions & 82 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "raml1-to-postman",
"version": "0.2.0",
"version": "0.3.0",
"description": "Converts RAML 1.0 files to postman v2 collection",
"homepage": "https://github.com/postmanlabs/raml1-to-postman",
"bugs": "https://github.com/postmanlabs/raml1-to-postman/issues",
Expand Down Expand Up @@ -43,8 +43,7 @@
"async": "3.2.5",
"lodash": "4.17.21",
"path-browserify": "1.0.1",
"postman-collection": "4.2.1",
"webapi-parser": "0.5.0"
"postman-collection": "4.2.1"
},
"devDependencies": {
"chai": "4.1.2",
Expand Down

0 comments on commit 043a63b

Please sign in to comment.