refactor: type-check (#586)
* refactor: type-check * fix: default * refactor: type-check
This commit is contained in:
1 parent
fa78e6567c
commit
fb3370ccf9
83 files changed
+566
-943
No files matched your search
@@ -42,7 +42,7 @@ export abstract class OneBotAction<PayloadType, ReturnDataType> {
|
||||
|
||||
protected async check(payload: PayloadType): Promise<BaseCheckResult> {
|
||||
if (this.payloadSchema) {
|
||||
this.validate = new Ajv({ allowUnionTypes: true }).compile(this.payloadSchema);
|
||||
this.validate = new Ajv({ allowUnionTypes: true, useDefaults: true }).compile(this.payloadSchema);
|
||||
}
|
||||
if (this.validate && !this.validate(payload)) {
|
||||
const errors = this.validate.errors as ErrorObject[];
|
||||
|
||||
Reference in new issue
Block a user