Move splitted operation refer to cli-split-operation-splitted-operations

This commit is contained in:
xichen 2020-06-08 10:58:21 +08:00
Родитель a3d3d567ad
Коммит 0a8222f2e7
3 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -347,6 +347,7 @@ export class Helper {
(isNullOrUndefined(NodeHelper.getPolyAsResourceParam(vv)) ? '' : `${NEW_LINE}${tab(3)}cli-poly-as-resource-subclass-param: ${NodeHelper.getCliKey(NodeHelper.getPolyAsResourceParam(vv), '<missing-clikey>')}`) +
(isNullOrUndefined(NodeHelper.getPolyAsResourceOriginalOperation(vv)) ? '' : `${NEW_LINE}${tab(3)}cli-poly-as-resource-original-operation: ${NodeHelper.getCliKey(NodeHelper.getPolyAsResourceOriginalOperation(vv), '<missing-clikey>')}`) +
(isNullOrUndefined(NodeHelper.getSplitOperationOriginalOperation(vv)) ? '' : `${NEW_LINE}${tab(3)}cli-split-operation-original-operation: ${NodeHelper.getCliKey(NodeHelper.getSplitOperationOriginalOperation(vv), '<missing-clikey>')}`) +
(NodeHelper.getSplitOperationSplittedOperations(vv, () => []).length === 0 ? '' : `${NEW_LINE}${tab(3)}cli-split-operation-splitted-operations: ${NodeHelper.getSplitOperationSplittedOperations(vv, () => []).map((vvv) => NodeHelper.getCliKey(vvv, '<missing-clikey>')).join(',')}`) +
`${NEW_LINE}${tab(3)}parameters:${NEW_LINE}`.concat(
vv.parameters.map(vvv => `${tab(3)}- parameterName: ${generateCliValue(vvv, 4)}${generatePropertyFlattenValue(vvv, 4)}${generatePropertyReadonlyValue(vvv, 4)}${generateDiscriminatorValueForParam(vvv, 4)}${NEW_LINE}` +
(isNullOrUndefined(NodeHelper.getPolyAsResourceBaseSchema(vvv)) ? '' : `${tab(4)}cli-poly-as-resource-base-schema: ${NodeHelper.getCliKey(NodeHelper.getPolyAsResourceBaseSchema(vvv), '<baseSchemaCliKeyMissing>')}${NEW_LINE}`) +

Просмотреть файл

@ -29,6 +29,7 @@ export class NodeHelper {
private static readonly POLY_AS_PARAM_ORIGINIAL_PARAMETER = 'cli-poly-as-param-original-parameter';
private static readonly POLY_AS_PARAM_EXPANDED = 'cli-poly-as-param-expanded';
private static readonly SPLIT_OPERATION_ORIGINAL_OPERATION = 'cli-split-operation-original-operation';
private static readonly SPLIT_OPERATION_SPLITTED_OPERATIONS = 'cli-split-operation-splitted-operations';
private static readonly SPLIT_OPERATION_NAMES = 'split-operation-names';
private static visitedKeyDict = {};
@ -219,6 +220,16 @@ export class NodeHelper {
return NodeHelper.getExtensionsProperty(op, NodeHelper.SPLIT_OPERATION_ORIGINAL_OPERATION, null);
}
public static addSplitOperationSplittedOperations(op: Operation, splittedOp: Operation) {
const ops: Operation[] = NodeHelper.getExtensionsProperty(op, NodeHelper.SPLIT_OPERATION_SPLITTED_OPERATIONS, () => []);
ops.push(splittedOp);
NodeHelper.setExtensionsProperty(op, NodeHelper.SPLIT_OPERATION_SPLITTED_OPERATIONS, ops);
}
public static getSplitOperationSplittedOperations(originalOperation: Operation, defaultValue: () => any): Operation[] {
return NodeHelper.getExtensionsProperty(originalOperation, NodeHelper.SPLIT_OPERATION_SPLITTED_OPERATIONS, defaultValue);
}
public static setPolyAsParamBaseSchema(param: Parameter, base: Schema) {
NodeHelper.setExtensionsProperty(param, NodeHelper.POLY_AS_PARAM_BASE_SCHEMA, base);
}

Просмотреть файл

@ -30,7 +30,7 @@ export class SplitOperation{
splittedOperations.forEach((splittedOperation) => {
// Link src operation to splitted operation
NodeHelper.addCliOperation(operation, splittedOperation);
NodeHelper.addSplitOperationSplittedOperations(operation, splittedOperation);
// Link splitted operation to src opreation
NodeHelper.setSplitOperationOriginalOperation(splittedOperation, operation);