Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve references in parameter items #365

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
321 changes: 113 additions & 208 deletions dist/api-spec-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ Converter.prototype.convertParameters = function (obj) {
delete param.example;
}
if (param.type === 'array') {
_this.convertItems(param);
var style = param.style || (param.in === 'query' || param.in === 'cookie' ? 'form' : 'simple');
if (style === 'matrix') {
param.collectionFormat = param.explode ? undefined : 'csv';
Expand All @@ -465,6 +466,13 @@ Converter.prototype.convertParameters = function (obj) {
});
};

Converter.prototype.convertItems = function (obj) {
obj.items = this.resolveReference(this.spec, obj.items, false);
if (obj.items.type === 'array') {
this.convertItems(obj.items);
}
};

Converter.prototype.copySchemaProperties = function (obj, props) {
var schema = this.resolveReference(this.spec, obj.schema, true);
if (!schema) return;
Expand Down Expand Up @@ -43045,53 +43053,37 @@ utils.intFromLE = intFromLE;
arguments[4][72][0].apply(exports,arguments)
},{"buffer":92,"dup":72}],247:[function(require,module,exports){
module.exports={
"_args": [
[
"[email protected]",
"/home/rbren/git/api-spec-converter"
]
],
"_development": true,
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"_location": "/elliptic",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "elliptic",
"escapedName": "elliptic",
"rawSpec": "6.5.3",
"saveSpec": null,
"fetchSpec": "6.5.3"
},
"_requiredBy": [
"/browserify-sign",
"/create-ecdh"
"name": "elliptic",
"version": "6.5.3",
"description": "EC cryptography",
"main": "lib/elliptic.js",
"files": [
"lib"
],
"_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
"_spec": "6.5.3",
"_where": "/home/rbren/git/api-spec-converter",
"author": {
"name": "Fedor Indutny",
"email": "[email protected]"
"scripts": {
"jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
"jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
"lint": "npm run jscs && npm run jshint",
"unit": "istanbul test _mocha --reporter=spec test/index.js",
"test": "npm run lint && npm run unit",
"version": "grunt dist && git add dist/"
},
"repository": {
"type": "git",
"url": "[email protected]:indutny/elliptic"
},
"keywords": [
"EC",
"Elliptic",
"curve",
"Cryptography"
],
"author": "Fedor Indutny <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/indutny/elliptic/issues"
},
"dependencies": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"hash.js": "^1.0.0",
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
},
"description": "EC cryptography",
"homepage": "https://github.com/indutny/elliptic",
"devDependencies": {
"brfs": "^1.4.3",
"coveralls": "^3.0.8",
Expand All @@ -43108,32 +43100,15 @@ module.exports={
"jshint": "^2.10.3",
"mocha": "^6.2.2"
},
"files": [
"lib"
],
"homepage": "https://github.com/indutny/elliptic",
"keywords": [
"EC",
"Elliptic",
"curve",
"Cryptography"
],
"license": "MIT",
"main": "lib/elliptic.js",
"name": "elliptic",
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/indutny/elliptic.git"
},
"scripts": {
"jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
"jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
"lint": "npm run jscs && npm run jshint",
"test": "npm run lint && npm run unit",
"unit": "istanbul test _mocha --reporter=spec test/index.js",
"version": "grunt dist && git add dist/"
},
"version": "6.5.3"
"dependencies": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"hash.js": "^1.0.0",
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
}
}

},{}],248:[function(require,module,exports){
Expand Down Expand Up @@ -172773,97 +172748,63 @@ module.exports = function (ast, vars) {
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./package.json":889,"estraverse":890,"source-map":861}],889:[function(require,module,exports){
module.exports={
"_args": [
[
"[email protected]",
"/home/rbren/git/api-spec-converter"
]
],
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha1-Dk/xcV8yh3XWyrUaxEpAbNer/9M=",
"_location": "/static-eval/escodegen",
"_optional": true,
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "escodegen",
"escapedName": "escodegen",
"rawSpec": "0.0.28",
"saveSpec": null,
"fetchSpec": "0.0.28"
},
"_requiredBy": [
"/static-eval"
],
"_resolved": "https://registry.npmjs.org/escodegen/-/escodegen-0.0.28.tgz",
"_spec": "0.0.28",
"_where": "/home/rbren/git/api-spec-converter",
"bin": {
"esgenerate": "bin/esgenerate.js",
"escodegen": "bin/escodegen.js"
},
"bugs": {
"url": "https://github.com/Constellation/escodegen/issues"
},
"dependencies": {
"esprima": "~1.0.2",
"estraverse": "~1.3.0",
"source-map": ">= 0.1.2"
},
"description": "ECMAScript code generator",
"devDependencies": {
"bower": "*",
"chai": "~1.7.2",
"commonjs-everywhere": "~0.8.0",
"esprima-moz": "*",
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9",
"grunt-contrib-jshint": "~0.5.0",
"grunt-mocha-test": "~0.6.2",
"q": "*",
"semver": "*"
},
"engines": {
"node": ">=0.4.0"
},
"homepage": "http://github.com/Constellation/escodegen.html",
"licenses": [
{
"type": "BSD",
"url": "http://github.com/Constellation/escodegen/raw/master/LICENSE.BSD"
}
],
"main": "escodegen.js",
"maintainers": [
{
"name": "Yusuke Suzuki",
"email": "[email protected]",
"url": "http://github.com/Constellation"
"description": "ECMAScript code generator",
"homepage": "http://github.com/Constellation/escodegen.html",
"main": "escodegen.js",
"bin": {
"esgenerate": "./bin/esgenerate.js",
"escodegen": "./bin/escodegen.js"
},
"version": "0.0.28",
"engines": {
"node": ">=0.4.0"
},
"maintainers": [
{
"name": "Yusuke Suzuki",
"email": "[email protected]",
"web": "http://github.com/Constellation"
}
],
"repository": {
"type": "git",
"url": "http://github.com/Constellation/escodegen.git"
},
"dependencies": {
"esprima": "~1.0.2",
"estraverse": "~1.3.0"
},
"optionalDependencies": {
"source-map": ">= 0.1.2"
},
"devDependencies": {
"esprima-moz": "*",
"commonjs-everywhere": "~0.8.0",
"q": "*",
"bower": "*",
"semver": "*",
"chai": "~1.7.2",
"grunt-contrib-jshint": "~0.5.0",
"grunt-cli": "~0.1.9",
"grunt": "~0.4.1",
"grunt-mocha-test": "~0.6.2"
},
"licenses": [
{
"type": "BSD",
"url": "http://github.com/Constellation/escodegen/raw/master/LICENSE.BSD"
}
],
"scripts": {
"test": "grunt travis",
"unit-test": "grunt test",
"lint": "grunt lint",
"release": "node tools/release.js",
"build-min": "./node_modules/.bin/cjsify -ma path: tools/entry-point.js > escodegen.browser.min.js",
"build": "./node_modules/.bin/cjsify -a path: tools/entry-point.js > escodegen.browser.js"
}
],
"name": "escodegen",
"optionalDependencies": {
"source-map": ">= 0.1.2"
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/Constellation/escodegen.git"
},
"scripts": {
"build": "cjsify -a path: tools/entry-point.js > escodegen.browser.js",
"build-min": "cjsify -ma path: tools/entry-point.js > escodegen.browser.min.js",
"lint": "grunt lint",
"release": "node tools/release.js",
"test": "grunt travis",
"unit-test": "grunt test"
},
"version": "0.0.28"
}

},{}],890:[function(require,module,exports){
/*
Copyright (C) 2012-2013 Yusuke Suzuki <[email protected]>
Expand Down Expand Up @@ -180839,41 +180780,12 @@ module.exports = {

},{"./common.js":922,"./statusCodes.js":927,"call-me-maybe":145,"co":148,"fs":140,"jgexml/jpath.js":421,"js-yaml":425,"node-fetch":724,"path":749,"url":959}],924:[function(require,module,exports){
module.exports={
"_args": [
[
"[email protected]",
"/home/rbren/git/api-spec-converter"
]
],
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha512-dc9gxEkxuJYPz9y0Fx3ypsaiA2enxHxz7Q0tlyjJ01TopT2aR/EuxZhIWkslaN/Fx5FTT2OOSlP5VnvTbvIj+Q==",
"_location": "/swagger2openapi",
"_optional": true,
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "swagger2openapi",
"escapedName": "swagger2openapi",
"rawSpec": "2.9.4",
"saveSpec": null,
"fetchSpec": "2.9.4"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/swagger2openapi/-/swagger2openapi-2.9.4.tgz",
"_spec": "2.9.4",
"_where": "/home/rbren/git/api-spec-converter",
"author": {
"name": "Mike Ralphson",
"email": "[email protected]"
},
"name": "swagger2openapi",
"version": "2.9.4",
"description": "Convert Swagger 2.0 definitions to OpenApi 3.0 and validate",
"main": "index.js",
"bin": {
"swagger2openapi": "swagger2openapi.js"
"swagger2openapi": "./swagger2openapi.js"
},
"browserify": {
"transform": [
Expand All @@ -180887,9 +180799,12 @@ module.exports={
]
]
},
"bugs": {
"url": "https://github.com/Mermade/swagger2openapi/issues"
"repository": {
"url": "https://github.com/Mermade/swagger2openapi.git",
"type": "git"
},
"author": "Mike Ralphson <[email protected]>",
"license": "BSD-3-Clause",
"dependencies": {
"ajv": "^5.0.1",
"call-me-maybe": "^1.0.1",
Expand All @@ -180901,14 +180816,6 @@ module.exports={
"should": "^13.0.1",
"yargs": "^9.0.1"
},
"description": "Convert Swagger 2.0 definitions to OpenApi 3.0 and validate",
"devDependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^7.1.0",
"babel-preset-es2015": "^6.24.1",
"webpack": "^3.5.6"
},
"homepage": "https://github.com/Mermade/swagger2openapi#readme",
"keywords": [
"swagger",
"openapi",
Expand All @@ -180920,14 +180827,12 @@ module.exports={
"validation",
"resolver"
],
"license": "BSD-3-Clause",
"main": "index.js",
"name": "swagger2openapi",
"repository": {
"url": "git+https://github.com/Mermade/swagger2openapi.git",
"type": "git"
},
"version": "2.9.4"
"devDependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^7.1.0",
"babel-preset-es2015": "^6.24.1",
"webpack": "^3.5.6"
}
}

},{}],925:[function(require,module,exports){
Expand Down
Loading