zudoku 0.3.0-dev.122 → 0.3.0-dev.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/plugins/openapi/Sidecar.js +9 -5
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.js +2 -3
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/createUrl.js +5 -1
- package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -1
- package/lib/{OperationList-NXG3nRzP.js → OperationList-BoB5bkdm.js} +2 -2
- package/lib/{OperationList-NXG3nRzP.js.map → OperationList-BoB5bkdm.js.map} +1 -1
- package/lib/{Route-CqCSuSdD.js → Route-DnFLPnPw.js} +2 -2
- package/lib/{Route-CqCSuSdD.js.map → Route-DnFLPnPw.js.map} +1 -1
- package/lib/{index-YcqHGXdv.js → index-Bx0AgZT5.js} +834 -853
- package/lib/index-Bx0AgZT5.js.map +1 -0
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/package.json +1 -1
- package/src/lib/plugins/openapi/Sidecar.tsx +25 -19
- package/src/lib/plugins/openapi/playground/Playground.tsx +3 -6
- package/src/lib/plugins/openapi/playground/createUrl.ts +6 -5
- package/lib/index-YcqHGXdv.js.map +0 -1
package/package.json
CHANGED
|
@@ -109,25 +109,31 @@ export const Sidecar = ({
|
|
|
109
109
|
|
|
110
110
|
const requestBodyContent = operation.requestBody?.content;
|
|
111
111
|
|
|
112
|
-
const path = operation.path.split("/").map((part, i, arr) =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
112
|
+
const path = operation.path.split("/").map((part, i, arr) => {
|
|
113
|
+
const isParam =
|
|
114
|
+
(part.startsWith("{") && part.endsWith("}")) || part.startsWith(":");
|
|
115
|
+
const paramName = isParam ? part.replace(/[:{}]/g, "") : undefined;
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
119
|
+
<Fragment key={part + i}>
|
|
120
|
+
{paramName ? (
|
|
121
|
+
<ColorizedParam
|
|
122
|
+
name={paramName}
|
|
123
|
+
backgroundOpacity="0"
|
|
124
|
+
// same as in `ParameterListItem`
|
|
125
|
+
slug={`${operation.slug}-${paramName.toLocaleLowerCase()}`}
|
|
126
|
+
>
|
|
127
|
+
{part}
|
|
128
|
+
</ColorizedParam>
|
|
129
|
+
) : (
|
|
130
|
+
part
|
|
131
|
+
)}
|
|
132
|
+
{i < arr.length - 1 ? "/" : null}
|
|
133
|
+
<wbr />
|
|
134
|
+
</Fragment>
|
|
135
|
+
);
|
|
136
|
+
});
|
|
131
137
|
|
|
132
138
|
const code = useMemo(() => {
|
|
133
139
|
const example = requestBodyContent?.[0]?.schema
|
|
@@ -164,8 +164,9 @@ export const Playground = ({
|
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
const path = url.split("/").map((part, i, arr) => {
|
|
167
|
-
const isPathParam =
|
|
168
|
-
|
|
167
|
+
const isPathParam =
|
|
168
|
+
(part.startsWith("{") && part.endsWith("}")) || part.startsWith(":");
|
|
169
|
+
const replaced = part.replace(/[:{}]/g, "");
|
|
169
170
|
const value = formState.pathParams.find((p) => p.name === replaced)?.value;
|
|
170
171
|
|
|
171
172
|
const pathParamValue = value ? (
|
|
@@ -191,10 +192,6 @@ export const Playground = ({
|
|
|
191
192
|
);
|
|
192
193
|
});
|
|
193
194
|
|
|
194
|
-
const lang = mimeTypeToLanguage(
|
|
195
|
-
queryMutation.data?.headers.get("Content-Type") ?? "",
|
|
196
|
-
);
|
|
197
|
-
|
|
198
195
|
const headerEntries = Array.from(queryMutation.data?.headers.entries() ?? []);
|
|
199
196
|
|
|
200
197
|
const urlQueryParams = formState.queryParams
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { PlaygroundForm } from "./Playground.js";
|
|
2
2
|
|
|
3
3
|
export const createUrl = (host: string, path: string, data: PlaygroundForm) => {
|
|
4
|
-
const filledPath = path.replace(
|
|
5
|
-
|
|
6
|
-
(
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const filledPath = path.replace(/(:\w+|\{\w+})/g, (match) => {
|
|
5
|
+
const key = match.replace(/[:{}]/g, "");
|
|
6
|
+
const value = data.pathParams.find((part) => part.name === key)?.value;
|
|
7
|
+
|
|
8
|
+
return value ?? match;
|
|
9
|
+
});
|
|
9
10
|
|
|
10
11
|
const url = new URL(filledPath, host);
|
|
11
12
|
|