@tim-smart/openapi-gen 0.4.6 → 0.4.8
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.
- package/main.js +12 -10
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -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
|
-
|
|
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)
|
|
@@ -35120,7 +35123,7 @@ var make64 = gen2(function* () {
|
|
|
35120
35123
|
return some2(transformer.onBoolean({ importName }));
|
|
35121
35124
|
}
|
|
35122
35125
|
case "array": {
|
|
35123
|
-
const nonEmpty = typeof schema.minItems === "number" && schema.minItems
|
|
35126
|
+
const nonEmpty = typeof schema.minItems === "number" && schema.minItems > 0;
|
|
35124
35127
|
return toSource(
|
|
35125
35128
|
importName,
|
|
35126
35129
|
itemsSchema(schema.items),
|
|
@@ -35260,7 +35263,7 @@ var layerTransformerSchema = sync6(JsonSchemaTransformer, () => {
|
|
|
35260
35263
|
},
|
|
35261
35264
|
onArray({ importName, schema, item, nonEmpty }) {
|
|
35262
35265
|
const modifiers = [];
|
|
35263
|
-
if ("minItems" in schema &&
|
|
35266
|
+
if ("minItems" in schema && nonEmpty) {
|
|
35264
35267
|
modifiers.push(`${importName}.minItems(${schema.minItems})`);
|
|
35265
35268
|
}
|
|
35266
35269
|
if ("maxItems" in schema) {
|
|
@@ -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:
|
|
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
|
) ?? [];
|