@tim-smart/openapi-gen 0.4.3 → 0.4.4

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 +19 -14
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -19351,6 +19351,7 @@ var TaggedError = (tag4) => {
19351
19351
  };
19352
19352
 
19353
19353
  // node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/esm/String.js
19354
+ var isString2 = isString;
19354
19355
  var toUpperCase = (self) => self.toUpperCase();
19355
19356
  var capitalize = (self) => {
19356
19357
  if (self.length === 0) return self;
@@ -34802,6 +34803,19 @@ var camelize = (self) => {
34802
34803
  return str;
34803
34804
  };
34804
34805
  var identifier2 = (operationId) => capitalize(camelize(operationId));
34806
+ var nonEmptyString3 = flow(
34807
+ fromNullable,
34808
+ filter(isString2),
34809
+ map2(trim),
34810
+ filter(isNonEmpty5)
34811
+ );
34812
+ var toComment = match2({
34813
+ onNone: () => "",
34814
+ onSome: (description) => `/**
34815
+ * ${description.split("\n").join("\n* ")}
34816
+ */
34817
+ `
34818
+ });
34805
34819
 
34806
34820
  // src/JsonSchemaGen.ts
34807
34821
  var make64 = gen2(function* () {
@@ -35300,18 +35314,6 @@ export type ${name2} = (typeof ${name2})[keyof typeof ${name2}];` : `${toComment
35300
35314
  }
35301
35315
  })
35302
35316
  );
35303
- var nonEmptyString3 = flow(
35304
- fromNullable,
35305
- map2(trim),
35306
- filter(isNonEmpty5)
35307
- );
35308
- var toComment = match2({
35309
- onNone: () => "",
35310
- onSome: (description) => `/**
35311
- * ${description.split("\n").join("\n* ")}
35312
- */
35313
- `
35314
- });
35315
35317
  function mergeSchemas(self, other) {
35316
35318
  if ("properties" in self && "properties" in other) {
35317
35319
  return {
@@ -35460,6 +35462,9 @@ var make65 = gen2(function* () {
35460
35462
  const op = {
35461
35463
  id: camelize(operation.operationId),
35462
35464
  method,
35465
+ description: nonEmptyString3(operation.description).pipe(
35466
+ orElse(() => nonEmptyString3(operation.summary))
35467
+ ),
35463
35468
  pathIds,
35464
35469
  pathTemplate,
35465
35470
  urlParams: [],
@@ -35631,7 +35636,7 @@ ${clientErrorSource(name2)}`;
35631
35636
  )
35632
35637
  );
35633
35638
  }
35634
- return `readonly "${operation.id}": (${args2.join(", ")}) => Effect.Effect<${success}, ${errors.join(" | ")}>`;
35639
+ return `${toComment(operation.description)}readonly "${operation.id}": (${args2.join(", ")}) => Effect.Effect<${success}, ${errors.join(" | ")}>`;
35635
35640
  };
35636
35641
  const operationsToImpl = (name2, operations) => `export const make = (
35637
35642
  httpClient: HttpClient.HttpClient,
@@ -35762,7 +35767,7 @@ ${clientErrorSource(name2)}`;
35762
35767
  errors.push(`${name2}Error<"${schema}", ${schema}>`);
35763
35768
  }
35764
35769
  }
35765
- return `readonly "${operation.id}": (${args2.join(", ")}) => Effect.Effect<${success}, ${errors.join(" | ")}>`;
35770
+ return `${toComment(operation.description)}readonly "${operation.id}": (${args2.join(", ")}) => Effect.Effect<${success}, ${errors.join(" | ")}>`;
35766
35771
  };
35767
35772
  const operationsToImpl = (name2, operations) => `export const make = (
35768
35773
  httpClient: HttpClient.HttpClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tim-smart/openapi-gen",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Generate Effect http clients from OpenAPI specs",
5
5
  "bin": "main.js",
6
6
  "repository": {