@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.
Files changed (2) hide show
  1. package/main.js +4 -5
  2. 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 successCodes = Array.from(
35752
- operation.successSchemas.keys(),
35753
- (_) => JSON.stringify(_)
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 ")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tim-smart/openapi-gen",
3
- "version": "0.3.16",
3
+ "version": "0.3.17",
4
4
  "description": "Generate Effect http clients from OpenAPI specs",
5
5
  "bin": "main.js",
6
6
  "repository": {