@tim-smart/openapi-gen 0.4.11 → 0.4.13

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 +11 -2
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -34935,7 +34935,9 @@ var make64 = gen2(function* () {
34935
34935
  isClass,
34936
34936
  isEnum
34937
34937
  });
34938
- return toSource(importName, schema, name2, topLevel).pipe(
34938
+ return toSource(importName, Object.keys(schema).length ? schema : {
34939
+ properties: {}
34940
+ }, name2, topLevel).pipe(
34939
34941
  map2(
34940
34942
  (source) => transformer.onTopLevel({
34941
34943
  importName,
@@ -35491,6 +35493,7 @@ var make65 = gen2(function* () {
35491
35493
  payloadFormData: false,
35492
35494
  successSchemas: /* @__PURE__ */ new Map(),
35493
35495
  errorSchemas: /* @__PURE__ */ new Map(),
35496
+ voidSchemas: /* @__PURE__ */ new Set(),
35494
35497
  paramsOptional: true
35495
35498
  };
35496
35499
  const schemaId = identifier2(operation.operationId ?? path2);
@@ -35562,7 +35565,7 @@ var make65 = gen2(function* () {
35562
35565
  let defaultSchema;
35563
35566
  Object.entries(operation.responses ?? {}).forEach(
35564
35567
  ([status2, response]) => {
35565
- if ("$ref" in response) {
35568
+ while ("$ref" in response) {
35566
35569
  response = resolveRef2(response.$ref);
35567
35570
  }
35568
35571
  if (response.content?.["application/json"]?.schema) {
@@ -35586,6 +35589,9 @@ var make65 = gen2(function* () {
35586
35589
  op.errorSchemas.set(statusLower, schemaName);
35587
35590
  }
35588
35591
  }
35592
+ if (!response.content) {
35593
+ op.voidSchemas.add(status2.toLowerCase());
35594
+ }
35589
35595
  }
35590
35596
  );
35591
35597
  if (op.successSchemas.size === 0 && defaultSchema) {
@@ -35730,6 +35736,9 @@ ${clientErrorSource(name2)}`;
35730
35736
  operation.errorSchemas.forEach((schema, status2) => {
35731
35737
  decodes.push(`"${status2}": decodeError("${schema}", ${schema})`);
35732
35738
  });
35739
+ operation.voidSchemas.forEach((status2) => {
35740
+ decodes.push(`"${status2}": () => Effect.void`);
35741
+ });
35733
35742
  decodes.push(`orElse: unexpectedStatus`);
35734
35743
  pipeline.push(`withResponse(HttpClientResponse.matchStatus({
35735
35744
  ${decodes.join(",\n ")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tim-smart/openapi-gen",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "Generate Effect http clients from OpenAPI specs",
5
5
  "bin": "main.js",
6
6
  "repository": {