@tim-smart/openapi-gen 0.3.18 → 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 +5 -5
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -35541,7 +35541,7 @@ var layerTransformerSchema2 = sync6(OpenApiTransformer, () => {
35541
35541
  const varName = operation.payload ? "options.params?." : "options?.";
35542
35542
  if (operation.urlParams.length > 0) {
35543
35543
  const props = operation.urlParams.map(
35544
- (param) => `"${param}": ${varName}["${param}"] as UrlParams.Coercible`
35544
+ (param) => `"${param}": ${varName}["${param}"] as any`
35545
35545
  );
35546
35546
  pipeline.push(`HttpClientRequest.setUrlParams({ ${props.join(", ")} })`);
35547
35547
  }
@@ -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"'
@@ -35734,7 +35735,7 @@ export const ${name2}Error = <Tag extends string, E>(
35734
35735
  const varName = operation.payload ? "options.params?." : "options?.";
35735
35736
  if (operation.urlParams.length > 0) {
35736
35737
  const props = operation.urlParams.map(
35737
- (param) => `"${param}": ${varName}["${param}"] as UrlParams.Coercible`
35738
+ (param) => `"${param}": ${varName}["${param}"] as any`
35738
35739
  );
35739
35740
  pipeline.push(`HttpClientRequest.setUrlParams({ ${props.join(", ")} })`);
35740
35741
  }
@@ -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.18",
3
+ "version": "0.3.20",
4
4
  "description": "Generate Effect http clients from OpenAPI specs",
5
5
  "bin": "main.js",
6
6
  "repository": {