diff --git a/lib/importers/baseraml.js b/lib/importers/baseraml.js index 1f646c18..ff48da66 100644 --- a/lib/importers/baseraml.js +++ b/lib/importers/baseraml.js @@ -203,13 +203,15 @@ class RAMLImporter extends Importer { return this._mapHeadersParameters(data, traits); } - _mapURIParams(uriParams) { + _mapURIParams(uriParams, path) { const pathParams = {type: 'object', properties: {}, required: []}; for (const i in uriParams) { if (!uriParams.hasOwnProperty(i)) continue; const key = uriParams[i]; + if (!_.includes(path, key.name)) continue; + pathParams.properties[key.name] = { type: key.type || 'string' }; @@ -476,18 +478,19 @@ class RAMLImporter extends Importer { _mapEndpoint(project, resource, baseURI, pathParams) { let resultParams = JSON.parse(JSON.stringify(pathParams)); + const path = baseURI + resource.relativeUri; if (resource.uriParameters) { if(_.isEmpty(resultParams)) - resultParams = this._mapURIParams(resource.uriParameters); + resultParams = this._mapURIParams(resource.uriParameters, path); else{ - let newParams = this._mapURIParams(resource.uriParameters); + let newParams = this._mapURIParams(resource.uriParameters, path); _.merge(resultParams.properties, newParams.properties); resultParams.required = _.concat(resultParams.required, newParams.required); } } const mResource = { - path: baseURI + resource.relativeUri, + path: path, endpoints: [], annotations: {} }; diff --git a/test/data/raml-import/raml/raml08-pathParams-2-novalidate.yaml b/test/data/raml-import/raml/raml08-pathParams-2.yaml similarity index 100% rename from test/data/raml-import/raml/raml08-pathParams-2-novalidate.yaml rename to test/data/raml-import/raml/raml08-pathParams-2.yaml diff --git a/test/data/raml-import/swagger/raml08-pathParams-2-novalidate.yaml b/test/data/raml-import/swagger/raml08-pathParams-2.yaml similarity index 96% rename from test/data/raml-import/swagger/raml08-pathParams-2-novalidate.yaml rename to test/data/raml-import/swagger/raml08-pathParams-2.yaml index 607f4af3..e1257e77 100644 --- a/test/data/raml-import/swagger/raml08-pathParams-2-novalidate.yaml +++ b/test/data/raml-import/swagger/raml08-pathParams-2.yaml @@ -108,11 +108,6 @@ paths: in: path required: true type: string - - name: mediaTypeExtension - in: path - description: Media type - required: true - type: string put: operationId: PUT_identities-id-make_primary description: |