diff --git a/plugins/importer-openapi/src/index.ts b/plugins/importer-openapi/src/index.ts index 9b5f8170..8253022f 100644 --- a/plugins/importer-openapi/src/index.ts +++ b/plugins/importer-openapi/src/index.ts @@ -685,8 +685,10 @@ function shouldInlinePathParameter( } if (isRecord(parameter.content)) return false; const value = parameterExampleValue(parameter, importState); + const style = stringAt(parameter, "style"); return ( - stringAt(parameter, "style") === "matrix" || + style === "label" || + style === "matrix" || Array.isArray(value) || isRecord(value) ); diff --git a/plugins/importer-openapi/tests/index.test.ts b/plugins/importer-openapi/tests/index.test.ts index 048260b2..8043eb62 100644 --- a/plugins/importer-openapi/tests/index.test.ts +++ b/plugins/importer-openapi/tests/index.test.ts @@ -906,7 +906,7 @@ describe("importer-openapi", () => { openapi: "3.0.4", info: { title: "Path Serialization Test", version: "1.0.0" }, paths: { - "/labels/{labels}/matrix/{coordinates}/report.{format}": { + "/labels/{labels}/matrix/{coordinates}/scalar/{color}/report.{format}": { get: { parameters: [ { @@ -931,6 +931,13 @@ describe("importer-openapi", () => { required: true, schema: { type: "string", example: "json/evil" }, }, + { + name: "color", + in: "path", + required: true, + style: "label", + schema: { type: "string", example: "blue" }, + }, ], responses: {}, }, @@ -941,7 +948,7 @@ describe("importer-openapi", () => { expect(imported?.resources.httpRequests[0]).toEqual( expect.objectContaining({ - url: "${[baseUrl]}/labels/.one%2Ftwo.three/matrix/;x=1%3Bspoof%3D2;y=2/report.json%2Fevil", + url: "${[baseUrl]}/labels/.one%2Ftwo.three/matrix/;x=1%3Bspoof%3D2;y=2/scalar/.blue/report.json%2Fevil", urlParameters: [], }), );