How to use @ngtools/json-schema - 6 common examples

To help you get started, we’ve selected a few @ngtools/json-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / angular-cli / scripts / serialize.ts View on Github external
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, '');
github angular / angular-cli / packages / @angular / cli / utilities / schematics.ts View on Github external
engineHost.registerOptionsTransform((schematic: FileSystemSchematicDesc, options: any) => {
    if (schematic.schema) {
      const SchemaMetaClass = SchemaClassFactory(schematic.schemaJson!);
      const schemaClass = new SchemaMetaClass(options);
      return schemaClass.$$root();
    }
    return options;
  });
github fossasia / susper.com / node_modules / @angular-devkit / core / src / json / schema / serializers / javascript_benchmark.js View on Github external
}, () => {
        const SchemaMetaClass = json_schema_1.SchemaClassFactory(complexSchema);
        const schemaClass = new SchemaMetaClass({});
        schemaClass.$$root();
    });
    (function () {
github fossasia / susper.com / node_modules / @angular / cli / utilities / schematics.js View on Github external
engineHost.registerOptionsTransform((schematic, options) => {
        if (schematic.schema) {
            const SchemaMetaClass = json_schema_1.SchemaClassFactory(schematic.schemaJson);
            const schemaClass = new SchemaMetaClass(options);
            return schemaClass.$$root();
        }
        return options;
    });
    const collection = engine.createCollection(collectionName);
github angular / angular-cli / tools / publish / src / build-schema.ts View on Github external
export function buildSchema(inFile: string, _logger: logging.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');
}
github fossasia / susper.com / node_modules / @angular / cli / models / config / config.js View on Github external
constructor(_configPath, schema, configJson, fallbacks = []) {
        this._configPath = _configPath;
        this._config = new (json_schema_1.SchemaClassFactory(schema))(configJson, ...fallbacks);
    }
    get config() { return this._config; }

@ngtools/json-schema

Schema validating and reading for configurations, similar to Angular CLI config.

MIT
Latest version published 7 years ago

Package Health Score

78 / 100
Full package analysis

Popular @ngtools/json-schema functions