Commit 1ce0062f authored by nanahira's avatar nanahira

treat empty class as Schema.object

parent 7d860649
Pipeline #6301 passed with stages
in 1 minute and 5 seconds
{ {
"name": "koishi-utils-schemagen", "name": "koishi-utils-schemagen",
"version": "1.1.2", "version": "1.1.3",
"description": "在 Koishi.js 中,使用类装饰器定义 Schema", "description": "在 Koishi.js 中,使用类装饰器定义 Schema",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
......
...@@ -94,7 +94,7 @@ export function schemaFromClass<T>(cl: ClassConstructor<T>): Schema<T> { ...@@ -94,7 +94,7 @@ export function schemaFromClass<T>(cl: ClassConstructor<T>): Schema<T> {
let schema: Schema; let schema: Schema;
const optionsDict = schemaOptionsFromClass(cl); const optionsDict = schemaOptionsFromClass(cl);
if (!optionsDict) { if (!optionsDict) {
schema = Schema.any(); schema = Schema.object({}, true);
} else { } else {
schema = schemasFromDict<T>(optionsDict); schema = schemasFromDict<T>(optionsDict);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment