本文整理汇总了TypeScript中@ngtools/json-schema.SchemaClassFactory函数的典型用法代码示例。如果您正苦于以下问题:TypeScript SchemaClassFactory函数的具体用法?TypeScript SchemaClassFactory怎么用?TypeScript SchemaClassFactory使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SchemaClassFactory函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: buildSchema
export function buildSchema(inFile: string, _logger: Logger): string {
const jsonSchema = JSON.parse(fs.readFileSync(inFile, 'utf-8'));
const SchemaClass = SchemaClassFactory(jsonSchema);
const schemaInstance = new SchemaClass({});
return schemaInstance.$$serialize('text/x.dts', 'CliConfig');
}
示例2: SchemaMetaClass
engineHost.registerOptionsTransform((schematic: FileSystemSchematicDesc, options: any) => {
if (schematic.schema) {
const SchemaMetaClass = SchemaClassFactory<any>(schematic.schemaJson!);
const schemaClass = new SchemaMetaClass(options);
return schemaClass.$$root();
}
return options;
});
示例3: buildSchema
export function buildSchema(inFile: string, mimetype: string): string {
const jsonSchema = JSON.parse(fs.readFileSync(inFile, 'utf-8'));
const SchemaClass = SchemaClassFactory(jsonSchema);
const schemaInstance = new SchemaClass({});
let name = inFile.split(/[\/\\]/g).pop();
if (name) {
name = strings.classify(name.replace(/\.[^.]*$/, ''));
}
const license = `/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
`.replace(/^ {4}/gm, '');
return license + schemaInstance.$$serialize(mimetype, name);
}