mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-26 21:34:07 +02:00
fix(openapi): preserve scalar label delimiters
This commit is contained in:
@@ -685,8 +685,10 @@ function shouldInlinePathParameter(
|
|||||||
}
|
}
|
||||||
if (isRecord(parameter.content)) return false;
|
if (isRecord(parameter.content)) return false;
|
||||||
const value = parameterExampleValue(parameter, importState);
|
const value = parameterExampleValue(parameter, importState);
|
||||||
|
const style = stringAt(parameter, "style");
|
||||||
return (
|
return (
|
||||||
stringAt(parameter, "style") === "matrix" ||
|
style === "label" ||
|
||||||
|
style === "matrix" ||
|
||||||
Array.isArray(value) ||
|
Array.isArray(value) ||
|
||||||
isRecord(value)
|
isRecord(value)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -906,7 +906,7 @@ describe("importer-openapi", () => {
|
|||||||
openapi: "3.0.4",
|
openapi: "3.0.4",
|
||||||
info: { title: "Path Serialization Test", version: "1.0.0" },
|
info: { title: "Path Serialization Test", version: "1.0.0" },
|
||||||
paths: {
|
paths: {
|
||||||
"/labels/{labels}/matrix/{coordinates}/report.{format}": {
|
"/labels/{labels}/matrix/{coordinates}/scalar/{color}/report.{format}": {
|
||||||
get: {
|
get: {
|
||||||
parameters: [
|
parameters: [
|
||||||
{
|
{
|
||||||
@@ -931,6 +931,13 @@ describe("importer-openapi", () => {
|
|||||||
required: true,
|
required: true,
|
||||||
schema: { type: "string", example: "json/evil" },
|
schema: { type: "string", example: "json/evil" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "color",
|
||||||
|
in: "path",
|
||||||
|
required: true,
|
||||||
|
style: "label",
|
||||||
|
schema: { type: "string", example: "blue" },
|
||||||
|
},
|
||||||
],
|
],
|
||||||
responses: {},
|
responses: {},
|
||||||
},
|
},
|
||||||
@@ -941,7 +948,7 @@ describe("importer-openapi", () => {
|
|||||||
|
|
||||||
expect(imported?.resources.httpRequests[0]).toEqual(
|
expect(imported?.resources.httpRequests[0]).toEqual(
|
||||||
expect.objectContaining({
|
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: [],
|
urlParameters: [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user