enlace-openapi 0.0.1-beta.4 → 0.0.1-beta.5
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/dist/cli.js +5 -4
- package/dist/cli.mjs +5 -4
- package/dist/index.js +5 -4
- package/dist/index.mjs +5 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -84,7 +84,7 @@ function typeToSchema(type, ctx) {
|
|
|
84
84
|
);
|
|
85
85
|
const hasNull = type.types.some((t) => t.flags & import_typescript.default.TypeFlags.Null);
|
|
86
86
|
if (nonNullTypes.length === 1 && hasNull) {
|
|
87
|
-
const schema = typeToSchema(nonNullTypes[0], ctx);
|
|
87
|
+
const schema = typeToSchema(nonNullTypes[0], { ...ctx, depth: ctx.depth + 1 });
|
|
88
88
|
return { ...schema, nullable: true };
|
|
89
89
|
}
|
|
90
90
|
if (nonNullTypes.every((t) => t.isStringLiteral())) {
|
|
@@ -99,19 +99,20 @@ function typeToSchema(type, ctx) {
|
|
|
99
99
|
enum: nonNullTypes.map((t) => t.value)
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
+
const nextCtx = { ...ctx, depth: ctx.depth + 1 };
|
|
102
103
|
return {
|
|
103
|
-
oneOf: nonNullTypes.map((t) => typeToSchema(t,
|
|
104
|
+
oneOf: nonNullTypes.map((t) => typeToSchema(t, nextCtx))
|
|
104
105
|
};
|
|
105
106
|
}
|
|
106
107
|
if (type.isIntersection()) {
|
|
107
|
-
return intersectionTypeToSchema(type, ctx);
|
|
108
|
+
return intersectionTypeToSchema(type, { ...ctx, depth: ctx.depth + 1 });
|
|
108
109
|
}
|
|
109
110
|
if (checker.isArrayType(type)) {
|
|
110
111
|
const typeArgs = type.typeArguments;
|
|
111
112
|
if (typeArgs?.[0]) {
|
|
112
113
|
return {
|
|
113
114
|
type: "array",
|
|
114
|
-
items: typeToSchema(typeArgs[0], ctx)
|
|
115
|
+
items: typeToSchema(typeArgs[0], { ...ctx, depth: ctx.depth + 1 })
|
|
115
116
|
};
|
|
116
117
|
}
|
|
117
118
|
return { type: "array" };
|
package/dist/cli.mjs
CHANGED
|
@@ -61,7 +61,7 @@ function typeToSchema(type, ctx) {
|
|
|
61
61
|
);
|
|
62
62
|
const hasNull = type.types.some((t) => t.flags & ts.TypeFlags.Null);
|
|
63
63
|
if (nonNullTypes.length === 1 && hasNull) {
|
|
64
|
-
const schema = typeToSchema(nonNullTypes[0], ctx);
|
|
64
|
+
const schema = typeToSchema(nonNullTypes[0], { ...ctx, depth: ctx.depth + 1 });
|
|
65
65
|
return { ...schema, nullable: true };
|
|
66
66
|
}
|
|
67
67
|
if (nonNullTypes.every((t) => t.isStringLiteral())) {
|
|
@@ -76,19 +76,20 @@ function typeToSchema(type, ctx) {
|
|
|
76
76
|
enum: nonNullTypes.map((t) => t.value)
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
+
const nextCtx = { ...ctx, depth: ctx.depth + 1 };
|
|
79
80
|
return {
|
|
80
|
-
oneOf: nonNullTypes.map((t) => typeToSchema(t,
|
|
81
|
+
oneOf: nonNullTypes.map((t) => typeToSchema(t, nextCtx))
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
84
|
if (type.isIntersection()) {
|
|
84
|
-
return intersectionTypeToSchema(type, ctx);
|
|
85
|
+
return intersectionTypeToSchema(type, { ...ctx, depth: ctx.depth + 1 });
|
|
85
86
|
}
|
|
86
87
|
if (checker.isArrayType(type)) {
|
|
87
88
|
const typeArgs = type.typeArguments;
|
|
88
89
|
if (typeArgs?.[0]) {
|
|
89
90
|
return {
|
|
90
91
|
type: "array",
|
|
91
|
-
items: typeToSchema(typeArgs[0], ctx)
|
|
92
|
+
items: typeToSchema(typeArgs[0], { ...ctx, depth: ctx.depth + 1 })
|
|
92
93
|
};
|
|
93
94
|
}
|
|
94
95
|
return { type: "array" };
|
package/dist/index.js
CHANGED
|
@@ -92,7 +92,7 @@ function typeToSchema(type, ctx) {
|
|
|
92
92
|
);
|
|
93
93
|
const hasNull = type.types.some((t) => t.flags & import_typescript.default.TypeFlags.Null);
|
|
94
94
|
if (nonNullTypes.length === 1 && hasNull) {
|
|
95
|
-
const schema = typeToSchema(nonNullTypes[0], ctx);
|
|
95
|
+
const schema = typeToSchema(nonNullTypes[0], { ...ctx, depth: ctx.depth + 1 });
|
|
96
96
|
return { ...schema, nullable: true };
|
|
97
97
|
}
|
|
98
98
|
if (nonNullTypes.every((t) => t.isStringLiteral())) {
|
|
@@ -107,19 +107,20 @@ function typeToSchema(type, ctx) {
|
|
|
107
107
|
enum: nonNullTypes.map((t) => t.value)
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
+
const nextCtx = { ...ctx, depth: ctx.depth + 1 };
|
|
110
111
|
return {
|
|
111
|
-
oneOf: nonNullTypes.map((t) => typeToSchema(t,
|
|
112
|
+
oneOf: nonNullTypes.map((t) => typeToSchema(t, nextCtx))
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
115
|
if (type.isIntersection()) {
|
|
115
|
-
return intersectionTypeToSchema(type, ctx);
|
|
116
|
+
return intersectionTypeToSchema(type, { ...ctx, depth: ctx.depth + 1 });
|
|
116
117
|
}
|
|
117
118
|
if (checker.isArrayType(type)) {
|
|
118
119
|
const typeArgs = type.typeArguments;
|
|
119
120
|
if (typeArgs?.[0]) {
|
|
120
121
|
return {
|
|
121
122
|
type: "array",
|
|
122
|
-
items: typeToSchema(typeArgs[0], ctx)
|
|
123
|
+
items: typeToSchema(typeArgs[0], { ...ctx, depth: ctx.depth + 1 })
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
126
|
return { type: "array" };
|
package/dist/index.mjs
CHANGED
|
@@ -55,7 +55,7 @@ function typeToSchema(type, ctx) {
|
|
|
55
55
|
);
|
|
56
56
|
const hasNull = type.types.some((t) => t.flags & ts.TypeFlags.Null);
|
|
57
57
|
if (nonNullTypes.length === 1 && hasNull) {
|
|
58
|
-
const schema = typeToSchema(nonNullTypes[0], ctx);
|
|
58
|
+
const schema = typeToSchema(nonNullTypes[0], { ...ctx, depth: ctx.depth + 1 });
|
|
59
59
|
return { ...schema, nullable: true };
|
|
60
60
|
}
|
|
61
61
|
if (nonNullTypes.every((t) => t.isStringLiteral())) {
|
|
@@ -70,19 +70,20 @@ function typeToSchema(type, ctx) {
|
|
|
70
70
|
enum: nonNullTypes.map((t) => t.value)
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
+
const nextCtx = { ...ctx, depth: ctx.depth + 1 };
|
|
73
74
|
return {
|
|
74
|
-
oneOf: nonNullTypes.map((t) => typeToSchema(t,
|
|
75
|
+
oneOf: nonNullTypes.map((t) => typeToSchema(t, nextCtx))
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
if (type.isIntersection()) {
|
|
78
|
-
return intersectionTypeToSchema(type, ctx);
|
|
79
|
+
return intersectionTypeToSchema(type, { ...ctx, depth: ctx.depth + 1 });
|
|
79
80
|
}
|
|
80
81
|
if (checker.isArrayType(type)) {
|
|
81
82
|
const typeArgs = type.typeArguments;
|
|
82
83
|
if (typeArgs?.[0]) {
|
|
83
84
|
return {
|
|
84
85
|
type: "array",
|
|
85
|
-
items: typeToSchema(typeArgs[0], ctx)
|
|
86
|
+
items: typeToSchema(typeArgs[0], { ...ctx, depth: ctx.depth + 1 })
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
return { type: "array" };
|