@necessarylion/adonis-autoswagger 0.0.15 → 0.0.17
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/file.d.ts +1 -1
- package/dist/file.js +8 -3
- package/dist/parsers/validator_parser.js +0 -1
- package/dist/schema.js +5 -1
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/file.d.ts
CHANGED
package/dist/file.js
CHANGED
|
@@ -74,17 +74,22 @@ class FileService {
|
|
|
74
74
|
* @param files_ string[]
|
|
75
75
|
* @returns
|
|
76
76
|
*/
|
|
77
|
-
async getFiles(dir, files_) {
|
|
77
|
+
async getFiles(dir, files_, ignoreFiles) {
|
|
78
78
|
const fs = require("fs");
|
|
79
79
|
files_ = files_ || [];
|
|
80
80
|
var files = await fs.readdirSync(dir);
|
|
81
81
|
for (let i in files) {
|
|
82
82
|
var name = dir + "/" + files[i];
|
|
83
83
|
if (fs.statSync(name).isDirectory()) {
|
|
84
|
-
await this.getFiles(name, files_);
|
|
84
|
+
await this.getFiles(name, files_, ignoreFiles);
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
|
-
|
|
87
|
+
if (ignoreFiles && ignoreFiles.some((pattern) => name.includes(pattern))) {
|
|
88
|
+
// skip
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
files_.push(name);
|
|
92
|
+
}
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
return files_;
|
|
@@ -108,7 +108,6 @@ class ValidatorParser {
|
|
|
108
108
|
const type = property["type"];
|
|
109
109
|
const field = property["fieldName"];
|
|
110
110
|
if (type === "object") {
|
|
111
|
-
console.log(field, property);
|
|
112
111
|
obj[field] = { type: "object", ...this.#parseSchema(property, refs) };
|
|
113
112
|
}
|
|
114
113
|
else {
|
package/dist/schema.js
CHANGED
|
@@ -151,7 +151,11 @@ class SchemaService {
|
|
|
151
151
|
if ((0, fs_2.existsSync)(p6)) {
|
|
152
152
|
p = p6;
|
|
153
153
|
}
|
|
154
|
-
const files = await this.fileService.getFiles(p, []);
|
|
154
|
+
const files = await this.fileService.getFiles(p, [], this.options.models?.ignores);
|
|
155
|
+
const modelPaths = this.options.models?.paths ?? [];
|
|
156
|
+
for (const modelPath of modelPaths) {
|
|
157
|
+
files.push(...await this.fileService.getFiles(path_1.default.join(this.options.appPath, modelPath), [], this.options.models?.ignores));
|
|
158
|
+
}
|
|
155
159
|
const readFile = util_1.default.promisify(fs_1.default.readFile);
|
|
156
160
|
if (this.options.debug) {
|
|
157
161
|
console.log("Found model files", files);
|
package/dist/types.d.ts
CHANGED