@tim-smart/openapi-gen 0.3.16 → 0.3.17
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/main.js +4 -5
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -35748,13 +35748,12 @@ export const ${name2}Error = <Tag extends string, E>(
|
|
|
35748
35748
|
} else {
|
|
35749
35749
|
pipeline.push("Effect.succeed");
|
|
35750
35750
|
}
|
|
35751
|
-
const
|
|
35752
|
-
|
|
35753
|
-
|
|
35754
|
-
).join(", ");
|
|
35751
|
+
const successCodesRaw = Array.from(operation.successSchemas.keys());
|
|
35752
|
+
const successCodes = successCodesRaw.map((_) => JSON.stringify(_)).join(", ");
|
|
35753
|
+
const singleSuccessCode = successCodesRaw.length === 1 && successCodesRaw[0].startsWith("2");
|
|
35755
35754
|
const errorCodes = Object.fromEntries(operation.errorSchemas.entries());
|
|
35756
35755
|
pipeline.push(
|
|
35757
|
-
`Effect.flatMap(onRequest([${successCodes}], ${JSON.stringify(errorCodes)}))`
|
|
35756
|
+
`Effect.flatMap(onRequest([${singleSuccessCode ? `"2xx"` : successCodes}], ${JSON.stringify(errorCodes)}))`
|
|
35758
35757
|
);
|
|
35759
35758
|
return `"${operation.id}": (${params}) => HttpClientRequest.make("${operation.method.toUpperCase()}")(${operation.pathTemplate}).pipe(
|
|
35760
35759
|
${pipeline.join(",\n ")}
|