ng2-json-editor
Version:
Angular2 component for editing large json documents
59 lines (58 loc) • 2.02 kB
TypeScript
import { JsonUtilService } from './json-util.service';
import { ComponentTypeService } from './component-type.service';
import { JSONSchema, SchemaOptions } from '../interfaces';
export declare class SchemaFixerService {
private jsonUtilService;
private componentTypeService;
constructor(jsonUtilService: JsonUtilService, componentTypeService: ComponentTypeService);
/**
* Fixes schema to be in a format that expected by json-editor
*
* @param schema - json schema
* @param config - schema specific options
* @return - fixed schema
*/
fixSchema(originalSchema: JSONSchema, config?: SchemaOptions): JSONSchema;
/**
* Enriches given schema with given configuration objects
* puts config into correct places in schema.
*
* @param schema - json schema
* @param config - schema specific options
*/
private enrichSchemaWithConfig(schema, config);
/**
* Applies all fixes to schema recursively
*/
private fixRecursively(schema);
/**
* Fixes disabled config to assign the disabled attribute
* to array items or object properties
*/
private fixDisabled(schema);
/**
* Fixes isDeleteDisabled config to assign the isDeleteDisabled attribute
* to array items or object properties
*/
private fixIsDeleteDisabled(schema);
/**
* Fixes order config to assign the right priority to properties
*/
private fixOrder(schema);
/**
* Fixes anyOf schemas with exactly same property structure
* it merges all enum fields in anyOf elements
*/
private fixAnyOf(schema);
private fixAllOf(schema);
/**
* Adds keys that matches `alwaysShowRegExp` to `alwaysShow`.
* Passes `alwaysShowRegExp` down to children so that it is applied recursively.
*/
private fixAlwaysShowRegExp(schema);
/**
* Removes alwayShow fields that aren't in the schema.properties
* and warns on console.
*/
private fixAlwaysShow(schema);
}