fix(openapi): preserve scalar label delimiters

This commit is contained in:
Gregory Schier
2026-08-19 13:05:22 -07:00
parent 67ead41c3e
commit 9644594df6
2 changed files with 12 additions and 3 deletions
+3 -1
View File
@@ -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)
);
+9 -2
View File
@@ -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: [],
}),
);