@tim-smart/openapi-gen 0.4.7 → 0.4.9

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 -9
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -34812,7 +34812,7 @@ var nonEmptyString3 = flow(
34812
34812
  var toComment = match2({
34813
34813
  onNone: () => "",
34814
34814
  onSome: (description) => `/**
34815
- * ${description.split("\n").join("\n* ")}
34815
+ * ${description.replace(/\*\//g, " * /").split("\n").join("\n* ")}
34816
34816
  */
34817
34817
  `
34818
34818
  });
@@ -34852,12 +34852,17 @@ var make64 = gen2(function* () {
34852
34852
  }
34853
34853
  return schema;
34854
34854
  }
34855
+ const seenRefs = /* @__PURE__ */ new Set();
34855
34856
  const addSchema = (name2, root2, context7, asStruct = false) => {
34856
34857
  root2 = cleanupSchema(root2);
34857
34858
  function addRefs(schema, childName, asStruct2 = true) {
34858
34859
  schema = cleanupSchema(schema);
34859
34860
  const enumSuffix = childName?.endsWith("Enum") ? "" : "Enum";
34860
34861
  if ("$ref" in schema) {
34862
+ if (seenRefs.has(schema.$ref)) {
34863
+ return;
34864
+ }
34865
+ seenRefs.add(schema.$ref);
34861
34866
  const resolved = resolveRef(schema, {
34862
34867
  ...root2,
34863
34868
  ...context7
@@ -34871,9 +34876,7 @@ var make64 = gen2(function* () {
34871
34876
  refStore.set(schema.$ref, resolved.schema);
34872
34877
  addRefs(resolved.schema, resolved.name);
34873
34878
  store.set(resolved.name, resolved.schema);
34874
- if (!asStruct2) {
34875
- classes.add(resolved.name);
34876
- }
34879
+ classes.add(resolved.name);
34877
34880
  } else if ("properties" in schema) {
34878
34881
  Object.entries(schema.properties).forEach(
34879
34882
  ([name3, s]) => addRefs(s, childName ? childName + identifier2(name3) : void 0)
@@ -35470,13 +35473,12 @@ var make65 = gen2(function* () {
35470
35473
  }
35471
35474
  return current;
35472
35475
  }
35473
- const handlePath = (path2, methods) => methodNames.filter(
35474
- (method) => !!methods[method] && !!methods[method].operationId
35475
- ).forEach((method) => {
35476
+ const handlePath = (path2, methods) => methodNames.filter((method) => !!methods[method]).forEach((method) => {
35476
35477
  const { ids: pathIds, path: pathTemplate } = processPath(path2);
35477
35478
  const operation = methods[method];
35479
+ const id2 = operation.operationId ? camelize(operation.operationId) : `${method.toUpperCase()}${path2}`;
35478
35480
  const op = {
35479
- id: camelize(operation.operationId),
35481
+ id: id2,
35480
35482
  method,
35481
35483
  description: nonEmptyString3(operation.description).pipe(
35482
35484
  orElse(() => nonEmptyString3(operation.summary))
@@ -35491,7 +35493,7 @@ var make65 = gen2(function* () {
35491
35493
  errorSchemas: /* @__PURE__ */ new Map(),
35492
35494
  paramsOptional: true
35493
35495
  };
35494
- const schemaId = identifier2(operation.operationId);
35496
+ const schemaId = identifier2(operation.operationId ?? path2);
35495
35497
  const validParameters = operation.parameters?.filter(
35496
35498
  (_) => _.in !== "path" && _.in !== "cookie"
35497
35499
  ) ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tim-smart/openapi-gen",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "description": "Generate Effect http clients from OpenAPI specs",
5
5
  "bin": "main.js",
6
6
  "repository": {