@tim-smart/openapi-gen 0.3.19 → 0.3.20

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 +3 -3
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -35566,9 +35566,11 @@ var layerTransformerSchema2 = sync6(OpenApiTransformer, () => {
35566
35566
  pipeline.push("Effect.succeed");
35567
35567
  }
35568
35568
  const decodes = [];
35569
+ const singleSuccessCode = operation.successSchemas.size === 1;
35569
35570
  operation.successSchemas.forEach((schema, status2) => {
35571
+ const statusCode = singleSuccessCode && status2.startsWith("2") ? "2xx" : status2;
35570
35572
  decodes.push(
35571
- `"${status2}": r => HttpClientResponse.schemaBodyJson(${schema})(r)`
35573
+ `"${statusCode}": r => HttpClientResponse.schemaBodyJson(${schema})(r)`
35572
35574
  );
35573
35575
  });
35574
35576
  operation.errorSchemas.forEach((schema, status2) => {
@@ -35588,7 +35590,6 @@ var layerTransformerSchema2 = sync6(OpenApiTransformer, () => {
35588
35590
  'import * as HttpClientError from "@effect/platform/HttpClientError"',
35589
35591
  'import * as HttpClientRequest from "@effect/platform/HttpClientRequest"',
35590
35592
  'import * as HttpClientResponse from "@effect/platform/HttpClientResponse"',
35591
- 'import * as UrlParams from "@effect/platform/UrlParams"',
35592
35593
  'import * as Effect from "effect/Effect"',
35593
35594
  'import type { ParseError } from "effect/ParseResult"',
35594
35595
  'import * as S from "effect/Schema"'
@@ -35775,7 +35776,6 @@ export const ${name2}Error = <Tag extends string, E>(
35775
35776
  'import * as HttpClientError from "@effect/platform/HttpClientError"',
35776
35777
  'import * as HttpClientRequest from "@effect/platform/HttpClientRequest"',
35777
35778
  'import * as HttpClientResponse from "@effect/platform/HttpClientResponse"',
35778
- 'import * as UrlParams from "@effect/platform/UrlParams"',
35779
35779
  'import * as Data from "effect/Data"',
35780
35780
  'import * as Effect from "effect/Effect"'
35781
35781
  ].join("\n"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tim-smart/openapi-gen",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "Generate Effect http clients from OpenAPI specs",
5
5
  "bin": "main.js",
6
6
  "repository": {