chore: catch api doc collection error

This commit is contained in:
ChengLei Shao 2023-08-24 09:50:33 +08:00
parent 1e0bedca86
commit 60b0fdd5ca
2 changed files with 12 additions and 1 deletions

View File

@ -7,6 +7,11 @@ export default (collection: Collection) => {
const parameters = {};
if (primaryKey) {
const primaryKeyField = collection.fields.get(primaryKey);
if (!primaryKeyField) {
throw new Error(`primaryKeyField not found: ${primaryKey}, ${collection.name}`);
}
Object.assign(parameters, {
collectionIndex: {
required: true,

View File

@ -52,11 +52,17 @@ export class SwaggerManager {
'hidden.$isFalsy': true,
},
});
for (const collection of collections) {
if (collection.name === 'roles') {
continue;
}
others = merge(others, this.collection2Swagger(collection.name, false));
try {
others = merge(others, this.collection2Swagger(collection.name, false));
} catch (e) {
this.app.log.error(e);
}
}
}
return merge(base, others);