@necessarylion/adonis-autoswagger 0.0.17 → 0.0.18
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.
|
@@ -251,14 +251,31 @@ class CommentParser {
|
|
|
251
251
|
ks.push(key);
|
|
252
252
|
if (value["required"])
|
|
253
253
|
required.push(key);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
: value["format"]
|
|
260
|
-
|
|
261
|
-
|
|
254
|
+
const type = typeof value["type"] === "undefined" ? "string" : value["type"];
|
|
255
|
+
if (type !== 'array') {
|
|
256
|
+
props.push({
|
|
257
|
+
[key]: {
|
|
258
|
+
type,
|
|
259
|
+
format: typeof value["format"] === "undefined"
|
|
260
|
+
? "string"
|
|
261
|
+
: value["format"],
|
|
262
|
+
example: parsedRef[key],
|
|
263
|
+
enum: value["enum"]
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
props.push({
|
|
269
|
+
[`${key}[]`]: {
|
|
270
|
+
type,
|
|
271
|
+
example: '',
|
|
272
|
+
items: {
|
|
273
|
+
type: value["items"]["type"],
|
|
274
|
+
format: value["items"]["format"],
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
262
279
|
});
|
|
263
280
|
const properties = props.reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
264
281
|
const appends = Object.keys(parsedRef).filter((k) => !ks.includes(k));
|
|
@@ -124,14 +124,16 @@ class ValidatorParser {
|
|
|
124
124
|
}
|
|
125
125
|
else {
|
|
126
126
|
const meta = this.#getMetaFromValidations(property["each"]["validations"], refs);
|
|
127
|
+
const subType = this.#getType(property["each"]["subtype"]);
|
|
127
128
|
obj[field] = {
|
|
128
129
|
type: "array",
|
|
129
130
|
items: {
|
|
130
131
|
type: this.#getType(property["each"]["type"]),
|
|
131
132
|
...meta,
|
|
133
|
+
format: subType === 'multipartFile' ? 'binary' : undefined,
|
|
132
134
|
example: meta.example ??
|
|
133
135
|
meta.minimum ??
|
|
134
|
-
this.exampleGenerator.exampleByType(
|
|
136
|
+
this.exampleGenerator.exampleByType(subType),
|
|
135
137
|
},
|
|
136
138
|
};
|
|
137
139
|
}
|