Commit 55860e5b authored by nanahira's avatar nanahira

catchup for toString method

parent 74ea4157
......@@ -24,7 +24,7 @@
"eslint-plugin-prettier": "^3.4.1",
"jest": "^27.4.3",
"prettier": "^2.4.1",
"schemastery": "^2.1.0",
"schemastery": "^2.1.1",
"ts-jest": "^27.0.7",
"typescript": "^4.5.2"
},
......@@ -4545,9 +4545,9 @@
}
},
"node_modules/schemastery": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-2.1.0.tgz",
"integrity": "sha512-D5wGNn5lc8GnhTzSl2ClH6RwUB69NMUrIXn6qWJVZSSq1fJtEodL9zXoJUbzoLQlL7rGMuO6entajhZvJY25Tw==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-2.1.1.tgz",
"integrity": "sha512-ORumqcbLhe4fp+eN5COUFejTxvdfAUCQCFVF4c69HuFdexbU8kgqQsOHjJ3ZXokV15xstwWHPwAVQ8/AwldROw==",
"dev": true
},
"node_modules/semver": {
......@@ -8711,9 +8711,9 @@
}
},
"schemastery": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-2.1.0.tgz",
"integrity": "sha512-D5wGNn5lc8GnhTzSl2ClH6RwUB69NMUrIXn6qWJVZSSq1fJtEodL9zXoJUbzoLQlL7rGMuO6entajhZvJY25Tw==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-2.1.1.tgz",
"integrity": "sha512-ORumqcbLhe4fp+eN5COUFejTxvdfAUCQCFVF4c69HuFdexbU8kgqQsOHjJ3ZXokV15xstwWHPwAVQ8/AwldROw==",
"dev": true
},
"semver": {
......
......@@ -32,12 +32,12 @@
"eslint-plugin-prettier": "^3.4.1",
"jest": "^27.4.3",
"prettier": "^2.4.1",
"schemastery": "^2.1.0",
"schemastery": "^2.1.1",
"ts-jest": "^27.0.7",
"typescript": "^4.5.2"
},
"peerDependencies": {
"schemastery": "^2.1.0"
"schemastery": "^2.1.1"
},
"dependencies": {
"lodash": "^4.17.21",
......
......@@ -102,6 +102,7 @@ const schemaFields: (keyof Schema)[] = [
const schemaFunctions: (keyof Schema)[] = [
'toJSON',
// 'toString',
'required',
'hidden',
'adaptive',
......@@ -165,6 +166,7 @@ export function SchemaClass<T>(originalClass: ClassType<T>) {
});
}
newClass.toString = schema.toString.bind(schema);
newClass[kSchema] = true;
return newClass;
}
......
......@@ -56,4 +56,9 @@ describe('Schema registration', () => {
const newSchema = schema.description('foo');
expect(newSchema.meta.description).toBe('foo');
});
it('should work in toString method', () => {
const schema = Config as Schema<Config>;
expect(schema.toString(true)).toBe('{ foo?: string }');
});
});
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