chore: 移除ConfigSchemaValidation

This commit is contained in:
thinkinggis 2021-08-04 19:59:49 +08:00
parent 873e70132f
commit 2a06485922
3 changed files with 1 additions and 61 deletions

View File

@ -197,10 +197,7 @@ export interface ILayer {
off(type: string, handler: (...args: any[]) => void): void;
emit(type: string, handler: unknown): void;
once(type: string, handler: (...args: any[]) => void): void;
/**
* JSON Schema
*/
getConfigSchemaForValidation(): object;
isDirty(): boolean;
/**
* 使

View File

@ -48,8 +48,6 @@ import { encodePickingColor } from '@antv/l7-utils';
import { EventEmitter } from 'eventemitter3';
import { Container } from 'inversify';
import { isFunction, isObject } from 'lodash';
// @ts-ignore
import mergeJsonSchemas from 'merge-json-schemas';
import { normalizePasses } from '../plugins/MultiPassRendererPlugin';
import { BlendTypes } from '../utils/blend';
import { handleStyleDataMapping } from '../utils/dataMappingStyle';
@ -807,18 +805,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
public getEncodedData() {
return this.encodedData;
}
public getConfigSchemaForValidation() {
if (!this.configSchema) {
// 相比 allOf, merge 有一些优势
// @see https://github.com/goodeggs/merge-json-schemas
this.configSchema = mergeJsonSchemas([
baseLayerSchema,
this.getConfigSchema(),
]);
}
return this.configSchema;
}
public getLegendItems(name: string): any {
const scale = this.styleAttributeService.getLayerAttributeScale(name);
if (scale) {

View File

@ -1,43 +0,0 @@
// import {
// IGlobalConfigService,
// ILayer,
// ILayerPlugin,
// ILogService,
// TYPES,
// } from '@antv/l7-core';
// import { inject, injectable } from 'inversify';
// /**
// * Layer 初始化阶段以及重绘阶段首先校验传入参数,如果校验失败则中断后续插件处理。
// */
// @injectable()
// export default class ConfigSchemaValidationPlugin implements ILayerPlugin {
// @inject(TYPES.IGlobalConfigService)
// private readonly configService: IGlobalConfigService;
// @inject(TYPES.ILogService)
// private readonly logger: ILogService;
// public apply(layer: ILayer) {
// layer.hooks.init.tap('ConfigSchemaValidationPlugin', () => {
// this.configService.registerLayerConfigSchemaValidator(
// layer.name as string,
// layer.getConfigSchemaForValidation(),
// );
// const { valid, errorText } = this.configService.validateLayerConfig(
// layer.name as string,
// layer.getLayerConfig(),
// );
// if (!valid) {
// this.logger.error(errorText || '');
// // 中断 init 过程
// return false;
// }
// });
// layer.hooks.beforeRender.tap('ConfigSchemaValidationPlugin', () => {
// // TODO: 配置项发生变化,需要重新校验
// });
// }
// }