* fix enum

* fix test

* add null check

* change type check

* change default value location

* update test

* add required

* add parameter process

Co-authored-by: xichen <xichen@microsoft.com>
This commit is contained in:
xichen 2020-07-30 13:14:55 +08:00 коммит произвёл GitHub
Родитель 41818df7f3
Коммит 67d17b0f28
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
52 изменённых файлов: 489 добавлений и 118 удалений

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

@ -4,6 +4,7 @@ import { CodeModel, Info, ObjectSchema, Operation, Parameter, OperationGroup, Pr
import { isNullOrUndefined, isString, isArray, isObject, isUndefined, isNull } from 'util';
import { keys } from '@azure-tools/linq';
import { NodeExtensionHelper, NodeHelper, NodeCliHelper } from './nodeHelper';
import { Helper } from './helper';
export class Dumper {
private debugEnabled = false;
@ -163,7 +164,7 @@ export class Dumper {
output.push(Dumper.tab(indent + 1) + 'readOnly: true');
}
if (parameter.schema instanceof ObjectSchema && NodeHelper.HasSubClass(parameter.schema)) {
if (Helper.isObjectSchema(parameter.schema) && NodeHelper.HasSubClass(parameter.schema as ObjectSchema)) {
output.push(Dumper.tab(indent + 1) + NodeHelper.DISCRIMINATOR_FLAG + ': true');
}
@ -203,7 +204,7 @@ export class Dumper {
output.push(Dumper.tab(indent + 1) + 'readOnly: true');
}
if (parameter.schema instanceof ObjectSchema && NodeHelper.HasSubClass(parameter.schema)) {
if (Helper.isObjectSchema(parameter.schema) && NodeHelper.HasSubClass(parameter.schema as ObjectSchema)) {
output.push(Dumper.tab(indent + 1) + NodeHelper.DISCRIMINATOR_FLAG + ': true');
}
@ -313,9 +314,9 @@ export class Dumper {
return o;
else if (isArray(o))
return o.map(v => Dumper.NEW_LINE + Dumper.tab(indent) + "- " + Dumper.formatValue(v, indent + 2/* one more indent for array*/)).join('');
else if (o instanceof ObjectSchema)
else if (Helper.isObjectSchema(o))
return `<${(o as ObjectSchema).language.default.name}>`;
else if (o instanceof Operation)
else if (Helper.isOperation(o))
return `<${(o as Operation).language.default.name}>`;
else if (isObject(o))
return keys(o).select(k => Dumper.NEW_LINE + Dumper.tab(indent) + `${k}: ${Dumper.formatValue(o[k], indent + 1)}`).join('');

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

@ -1,12 +1,13 @@
import { getAllProperties, ImplementationLocation, ObjectSchema, Parameter, Property, Request, VirtualParameter } from "@azure-tools/codemodel";
import { values } from "@azure-tools/linq";
import { isNullOrUndefined } from "util";
import { Helper } from "./helper";
import { NodeExtensionHelper, NodeCliHelper } from "./nodeHelper";
export class FlattenHelper {
public static flattenParameter(req: Request, param: Parameter, path: Property[], prefix: string): void {
if (!(param.schema instanceof ObjectSchema))
if (!Helper.isObjectSchema(param.schema))
throw Error(`Try to flatten non-object schema: param = '${param.language.default.name}', schema= '${param.schema.language.default.name}'`);
FlattenHelper.flattenPorperties(req, param, param.schema as ObjectSchema, path, prefix);
@ -48,6 +49,15 @@ export class FlattenHelper {
(vp.extensions = vp.extensions || {})['x-ms-parameter-grouping'] = parameter.extensions?.['x-ms-parameter-grouping'];
}
vp.required = parameter.required && property.required;
if (NodeCliHelper.getHidden(property.schema, false)) {
NodeCliHelper.setHidden(vp, true);
}
const cliDefaultValue = NodeCliHelper.getCliDefaultValue(property.schema);
if (cliDefaultValue !== undefined) {
NodeCliHelper.setCliDefaultValue(vp, cliDefaultValue);
}
yield vp;
}

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

@ -1,4 +1,4 @@
import { codeModelSchema, ChoiceSchema, ChoiceValue, CodeModel, ObjectSchema, Operation, OperationGroup, Parameter, Property, SealedChoiceSchema, Schema, ConstantSchema, SchemaType, StringSchema } from "@azure-tools/codemodel";
import { codeModelSchema, ChoiceSchema, ChoiceValue, CodeModel, ObjectSchema, Operation, OperationGroup, Parameter, Property, SealedChoiceSchema, Schema, ConstantSchema, SchemaType, StringSchema, DictionarySchema, ArraySchema, AnySchema } from "@azure-tools/codemodel";
import { isArray, isNullOrUndefined, isString } from "util";
import { CliConst, M4Node, M4NodeType, NamingType, CliCommonSchema } from "./schema";
import { EnglishPluralizationService, guid } from '@azure-tools/codegen';
@ -118,49 +118,49 @@ export class Helper {
public static ToNamingType(node: M4Node): NamingType | null {
if (node instanceof OperationGroup)
if (Helper.isOperationGroup(node))
return CliConst.NamingType.operationGroup;
else if (node instanceof Operation)
else if (Helper.isOperation(node))
return CliConst.NamingType.operation;
else if (node instanceof Parameter) {
else if (Helper.isParameter(node)) {
// workaround for modelerfour's bug, the naming convention is not applied to flattened parameter
// https://github.com/Azure/autorest.modelerfour/issues/195
if (node['flattened'] === true)
return null;
return node.schema?.type === SchemaType.Constant ? CliConst.NamingType.constant : CliConst.NamingType.parameter;
return (<Parameter>node).schema?.type === SchemaType.Constant ? CliConst.NamingType.constant : CliConst.NamingType.parameter;
}
else if (node instanceof ChoiceSchema)
else if (Helper.isChoiceSchema(node))
return CliConst.NamingType.choice;
else if (node instanceof SealedChoiceSchema)
else if (Helper.isSealedChoiceSchema(node))
return CliConst.NamingType.choice;
else if (node instanceof ConstantSchema)
else if (Helper.isConstantSchema(node))
return CliConst.NamingType.constant;
else if (node instanceof ChoiceValue)
else if (Helper.isChoiceValue(node))
return CliConst.NamingType.choiceValue;
// Treat other schema type as 'type' like 'string, 'number', 'array', 'dictionary', 'object'...
else if (node instanceof Schema)
else if (Helper.isSchema(node))
return CliConst.NamingType.type;
else if (node instanceof Property)
else if (Helper.isProperty(node))
return CliConst.NamingType.property;
return null;
}
public static ToM4NodeType(node: M4Node): M4NodeType {
if (node instanceof OperationGroup)
if (Helper.isOperationGroup(node))
return CliConst.SelectType.operationGroup;
else if (node instanceof Operation)
else if (Helper.isOperation(node))
return CliConst.SelectType.operation;
else if (node instanceof Parameter)
else if (Helper.isParameter(node))
return CliConst.SelectType.parameter;
else if (node instanceof ObjectSchema)
else if (Helper.isObjectSchema(node))
return CliConst.SelectType.objectSchema;
else if (node instanceof Property)
else if (Helper.isProperty(node))
return CliConst.SelectType.property;
else if (node instanceof ChoiceSchema)
else if (Helper.isChoiceSchema(node))
return CliConst.SelectType.choiceSchema;
else if (node instanceof SealedChoiceSchema)
else if (Helper.isSealedChoiceSchema(node))
return CliConst.SelectType.choiceSchema;
else if (node instanceof ChoiceValue)
else if (Helper.isChoiceValue(node))
return CliConst.SelectType.choiceValue;
throw Error(`Unsupported node type: ${typeof (node)}`);
}
@ -568,4 +568,231 @@ export class Helper {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isOperationGroup(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof OperationGroup) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
const props = Object.getOwnPropertyNames(o);
if (props.find((prop) => prop === '$key') && props.find((prop) => prop === 'operations')) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isOperation(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof Operation) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
const props = Object.getOwnPropertyNames(o);
if (props.find((prop) => prop === 'responses') || props.find((prop) => prop === 'parameters')) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isParameter(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof Parameter) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
const props = Object.getOwnPropertyNames(o);
if (props.find((prop) => prop === 'implementation') || props.find((prop) => prop === 'flattened') || props.find((prop) => prop === 'groupedBy')) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isObjectSchema(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof ObjectSchema) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
if (o.type === SchemaType.Object) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isDictionarySchema(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof DictionarySchema) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
if (o.type === SchemaType.Dictionary) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isArraySchema(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof ArraySchema) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
if (o.type === SchemaType.Array) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isAnySchema(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof AnySchema) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
if (o.type === SchemaType.Any) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isChoiceSchema(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof ChoiceSchema) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
if (o.type === SchemaType.Choice) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isSealedChoiceSchema(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof SealedChoiceSchema) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
if (o.type === SchemaType.SealedChoice) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isConstantSchema(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof ConstantSchema) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
if (o.type === SchemaType.Constant) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isChoiceValue(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof ChoiceValue) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
const props = Object.getOwnPropertyNames(o);
if (props.find((prop) => prop === 'language') && props.find((prop) => prop === 'value')) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isSchema(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof Schema) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
const props = Object.getOwnPropertyNames(o);
if (props.find((prop) => prop === 'type')) {
return true;
}
return false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public static isProperty(o: any): boolean {
if (isNullOrUndefined(o)) {
return false;
}
if (o instanceof Property) {
return true;
}
if (o.prototype !== Object.prototype) {
return false;
}
const props = Object.getOwnPropertyNames(o);
if (props.find((prop) => prop === 'serializedName')) {
return true;
}
return false;
}
}

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

@ -10,7 +10,7 @@ export class NodeCliHelper {
public static readonly POLY_RESOURCE: string = 'poly-resource';
public static readonly CLI_FLATTEN: string = 'cli-flatten';
public static readonly SPLIT_OPERATION_NAMES = 'split-operation-names';
private static readonly CLI: string = "cli";
private static readonly NAME: string = "name";
private static readonly DESCRIPTION: string = "description";
@ -23,7 +23,8 @@ export class NodeCliHelper {
private static readonly CLI_MARK: string = "cli-mark";
private static readonly CLI_IS_VISIBLE: string = "cli-is-visible";
private static readonly CLI_OPERATION_SPLITTED = 'cli-operation-splitted';
private static readonly JSON: string = "json";
private static readonly CLI_DEFAULT_VALUE: string = "default-value";
private static readonly POLY_AS_PARAM_EXPANDED = 'cli-poly-as-param-expanded';
@ -147,6 +148,15 @@ export class NodeCliHelper {
return NodeCliHelper.getCliProperty(node, NodeCliHelper.CLI_IS_VISIBLE, () => undefined);
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
public static setCliDefaultValue(node: M4Node, value: any): void {
NodeCliHelper.setCliProperty(node, NodeCliHelper.CLI_DEFAULT_VALUE, value);
}
public static getCliDefaultValue(node: M4Node): any {
return NodeCliHelper.getCliProperty(node, NodeCliHelper.CLI_DEFAULT_VALUE, () => undefined);
}
/**
* set node.language.cli.key = value
* @param node
@ -410,15 +420,15 @@ export class NodeHelper {
for (const key in allSubs) {
const subClass = allSubs[key];
if (!(subClass instanceof ObjectSchema)) {
if (!Helper.isObjectSchema(subClass)) {
Helper.logWarning("subclass is not ObjectSchema: " + subClass.language.default.name);
continue;
}
if (NodeHelper.HasSubClass(subClass) && leafOnly) {
if (NodeHelper.HasSubClass(subClass as ObjectSchema) && leafOnly) {
Helper.logWarning("skip subclass which also has subclass: " + subClass.language.default.name);
continue;
}
yield subClass;
yield subClass as ObjectSchema;
}
}
@ -435,7 +445,9 @@ export class NodeHelper {
}
public static getDefaultNameWithType(node: ObjectSchema | DictionarySchema | ArraySchema): string {
return `${node.language.default.name}(${node instanceof ObjectSchema ? node.type : node instanceof DictionarySchema ? (node.elementType.language.default.name + '^dictionary') : (node.elementType.language.default.name + '^array')})`;
return `${node.language.default.name}(${Helper.isObjectSchema(node) ? node.type :
Helper.isDictionarySchema(node) ? ((<DictionarySchema>node).elementType.language.default.name + '^dictionary') :
((<ArraySchema>node).elementType.language.default.name + '^array')})`;
}
public static checkVisibility(prop: Property): boolean {

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

@ -1,5 +1,5 @@
import { Host, Session } from "@azure-tools/autorest-extension-base";
import { CodeModel, isObjectSchema, ArraySchema, DictionarySchema, AnySchema, ConstantSchema, getAllProperties, ObjectSchema } from "@azure-tools/codemodel";
import { CodeModel, ArraySchema, DictionarySchema, getAllProperties, ObjectSchema } from "@azure-tools/codemodel";
import { isNullOrUndefined } from "util";
import { Helper } from "../helper";
import { CliCommonSchema } from "../schema";
@ -22,10 +22,10 @@ class ComplexMarker {
}
NodeCliHelper.setComplex(dict, CliCommonSchema.CodeModel.Complexity.unknown);
if (dict.elementType instanceof ObjectSchema ||
dict.elementType instanceof ArraySchema ||
dict.elementType instanceof DictionarySchema ||
dict.elementType instanceof AnySchema) {
if (Helper.isObjectSchema(dict.elementType) ||
Helper.isArraySchema(dict) ||
Helper.isDictionarySchema(dict.elementType) ||
Helper.isAnySchema(dict.elementType)) {
NodeCliHelper.setComplex(dict, CliCommonSchema.CodeModel.Complexity.dictionary_complex);
return CliCommonSchema.CodeModel.Complexity.dictionary_complex;
}
@ -47,10 +47,10 @@ class ComplexMarker {
}
NodeCliHelper.setComplex(arr, CliCommonSchema.CodeModel.Complexity.unknown);
if (arr.elementType instanceof ObjectSchema ||
arr.elementType instanceof ArraySchema ||
arr.elementType instanceof DictionarySchema ||
arr.elementType instanceof AnySchema) {
if (Helper.isObjectSchema(arr.elementType) ||
Helper.isArraySchema(arr.elementType) ||
Helper.isDictionarySchema(arr.elementType) ||
Helper.isAnySchema(arr.elementType)) {
NodeCliHelper.setComplex(arr, CliCommonSchema.CodeModel.Complexity.array_complex);
return CliCommonSchema.CodeModel.Complexity.array_complex;
}
@ -80,21 +80,21 @@ class ComplexMarker {
complexity = CliCommonSchema.CodeModel.Complexity.object_simple;
if (obj.properties && obj.properties.length > 0) {
for (const prop of obj.properties) {
if (isObjectSchema(prop.schema)) {
this.calculateObject(prop.schema);
if (Helper.isObjectSchema(prop.schema)) {
this.calculateObject(prop.schema as ObjectSchema);
return NodeCliHelper.setComplex(obj, CliCommonSchema.CodeModel.Complexity.object_complex);
}
else if (prop.schema instanceof ArraySchema) {
const c = this.calculateArray(prop.schema);
else if (Helper.isArraySchema(prop.schema)) {
const c = this.calculateArray(prop.schema as ArraySchema);
if (c === CliCommonSchema.CodeModel.Complexity.array_complex) {
return NodeCliHelper.setComplex(obj, CliCommonSchema.CodeModel.Complexity.object_complex);
}
}
else if (prop.schema instanceof DictionarySchema) {
this.calculateDict(prop.schema);
else if (Helper.isDictionarySchema(prop.schema)) {
this.calculateDict(prop.schema as DictionarySchema);
return NodeCliHelper.setComplex(obj, CliCommonSchema.CodeModel.Complexity.object_complex);
}
else if (prop.schema instanceof AnySchema) {
else if (Helper.isAnySchema(prop.schema)) {
return NodeCliHelper.setComplex(obj, CliCommonSchema.CodeModel.Complexity.object_complex);
}
}
@ -131,18 +131,18 @@ class ComplexMarker {
for (const p of getAllProperties(schema)) {
if (p.readOnly)
continue;
if (p.schema instanceof ConstantSchema)
if (Helper.isConstantSchema(p.schema))
continue;
if (p.schema instanceof AnySchema ||
p.schema instanceof ArraySchema ||
p.schema instanceof DictionarySchema) {
if (Helper.isAnySchema(p.schema) ||
Helper.isArraySchema(p.schema) ||
Helper.isDictionarySchema(p.schema)) {
return NodeCliHelper.setSimplifyIndicator(schema, impossible);
}
else if (p.schema instanceof ObjectSchema) {
if (NodeHelper.HasSubClass(p.schema)) {
else if (Helper.isObjectSchema(p.schema)) {
if (NodeHelper.HasSubClass(p.schema as ObjectSchema)) {
return NodeCliHelper.setSimplifyIndicator(schema, impossible);
}
const pi = this.setSimplifyIndicator(p.schema);
const pi = this.setSimplifyIndicator(p.schema as ObjectSchema);
if (pi.simplifiable === true) {
if (NodeCliHelper.getComplexity(p.schema) === CliCommonSchema.CodeModel.Complexity.object_simple)
indicator.propertyCountIfSimplifyWithoutSimpleObject++;
@ -185,22 +185,23 @@ class ComplexMarker {
else {
NodeCliHelper.setMark(schema, tag);
if (schema instanceof ArraySchema || schema instanceof DictionarySchema) {
if (schema.elementType instanceof ObjectSchema ||
schema.elementType instanceof DictionarySchema ||
schema.elementType instanceof ArraySchema) {
if (Helper.isArraySchema(schema) || Helper.isDictionarySchema(schema)) {
if (Helper.isObjectSchema((<ArraySchema | DictionarySchema>schema).elementType) ||
Helper.isDictionarySchema((<ArraySchema | DictionarySchema>schema).elementType) ||
Helper.isArraySchema((<ArraySchema | DictionarySchema>schema).elementType)) {
stack.push(schema);
this.setInCircle(schema.elementType, stack, tag);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.setInCircle((<ArraySchema<any> | DictionarySchema<any>>schema).elementType, stack, tag);
stack.splice(stack.length - 1, 1);
}
}
else if (schema instanceof ObjectSchema) {
for (const prop of getAllProperties(schema)) {
if (prop.schema instanceof ObjectSchema ||
prop.schema instanceof DictionarySchema ||
prop.schema instanceof ArraySchema) {
else if (Helper.isObjectSchema(schema)) {
for (const prop of getAllProperties(schema as ObjectSchema)) {
if (Helper.isObjectSchema(prop.schema) ||
Helper.isDictionarySchema(prop.schema) ||
Helper.isArraySchema(prop.schema)) {
stack.push(schema);
this.setInCircle(prop.schema, stack, tag);
this.setInCircle(prop.schema as ObjectSchema, stack, tag);
stack.splice(stack.length - 1, 1);
}
}
@ -211,7 +212,7 @@ class ComplexMarker {
public process(): void {
this.session.model.schemas.objects.forEach(obj => {
this.session.model.schemas.objects?.forEach(obj => {
NodeCliHelper.clearComplex(obj);
NodeCliHelper.clearSimplifyIndicator(obj);
NodeCliHelper.clearMark(obj);
@ -228,7 +229,7 @@ class ComplexMarker {
});
let tag = 1;
this.session.model.schemas.objects.forEach(obj => {
this.session.model.schemas.objects?.forEach(obj => {
this.calculateObject(obj);
tag++;
});
@ -241,12 +242,12 @@ class ComplexMarker {
tag++;
});
this.session.model.schemas.objects.forEach(obj => {
this.session.model.schemas.objects?.forEach(obj => {
this.setSimplifyIndicator(obj);
tag++;
});
this.session.model.schemas.objects.forEach(obj => {
this.session.model.schemas.objects?.forEach(obj => {
this.setInCircle(obj, [], tag.toString());
tag++;
});

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

@ -109,7 +109,7 @@ export class FlattenModifier {
private flattenNormalOperationParam(request: Request, index: number): boolean {
const parameter = request.parameters[index];
const paramSchema = parameter.schema;
if (!(paramSchema instanceof ObjectSchema)) {
if (!Helper.isObjectSchema(paramSchema)) {
Helper.logWarning(`flatten param ${NodeCliHelper.getCliKey(parameter, null)} is not object! Skip flatten`);
return false;
}

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

@ -1,5 +1,5 @@
import { Host, Session } from "@azure-tools/autorest-extension-base";
import { CodeModel, ObjectSchema, isObjectSchema, getAllProperties, Parameter, DictionarySchema, Schema, ArraySchema, ConstantSchema, AnySchema } from "@azure-tools/codemodel";
import { CodeModel, ObjectSchema, getAllProperties, Parameter, Schema, ArraySchema } from "@azure-tools/codemodel";
import { isNullOrUndefined, isArray } from "util";
import { Helper } from "../../helper";
import { NodeHelper, NodeCliHelper, NodeExtensionHelper } from "../../nodeHelper";
@ -50,16 +50,16 @@ export class FlattenSetter {
}
private canArrayObjectSimplified(schema: Schema, maxArrayObjProp: number) {
if (schema instanceof ObjectSchema && !NodeHelper.HasSubClass(schema)) {
const sim = NodeCliHelper.getSimplifyIndicator(schema);
if (Helper.isObjectSchema(schema) && !NodeHelper.HasSubClass(schema as ObjectSchema)) {
const sim = NodeCliHelper.getSimplifyIndicator(schema as ObjectSchema);
return ((!isNullOrUndefined(sim)) && sim.simplifiable === true && sim.propertyCountIfSimplify <= maxArrayObjProp);
}
return false;
}
private canSubclassSimplified(schema: Schema, flattenConfig: FlattenConfig, isPolyAsResource: boolean) {
if (schema instanceof ObjectSchema && !isNullOrUndefined(schema.discriminatorValue) && !NodeHelper.HasSubClass(schema)) {
const sim = NodeCliHelper.getSimplifyIndicator(schema);
if (Helper.isObjectSchema(schema) && !isNullOrUndefined((<ObjectSchema>schema).discriminatorValue) && !NodeHelper.HasSubClass(schema as ObjectSchema)) {
const sim = NodeCliHelper.getSimplifyIndicator(schema as ObjectSchema);
if (isPolyAsResource)
return ((!isNullOrUndefined(sim)) && sim.simplifiable === true && sim.propertyCountIfSimplifyWithoutSimpleObject <= flattenConfig.maxPolyAsResourcePropCount);
else
@ -90,27 +90,27 @@ export class FlattenSetter {
let r = level;
if (schema instanceof ArraySchema) {
if (Helper.isArraySchema(schema)) {
increasePropCount();
if (NodeCliHelper.getComplexity(schema) === CliCommonSchema.CodeModel.Complexity.array_complex) {
if (!this.canArrayObjectSimplified(schema, flattenConfig.maxArrayPropCount))
increaseComplexity();
}
}
else if (schema instanceof DictionarySchema) {
else if (Helper.isDictionarySchema(schema)) {
increasePropCount();
if (NodeCliHelper.getComplexity(schema) === CliCommonSchema.CodeModel.Complexity.dictionary_complex)
increaseComplexity();
}
else if (schema instanceof AnySchema) {
else if (Helper.isAnySchema(schema)) {
increasePropCount();
increaseComplexity();
}
// eslint-disable-next-line no-empty
else if (schema instanceof ConstantSchema) {
else if (Helper.isConstantSchema(schema)) {
}
else if (schema instanceof ObjectSchema) {
if (NodeHelper.HasSubClass(schema)) {
else if (Helper.isObjectSchema(schema)) {
if (NodeHelper.HasSubClass(schema as ObjectSchema)) {
increasePropCount();
increaseComplexity();
}
@ -120,7 +120,7 @@ export class FlattenSetter {
else {
info[level].propCount++;
info[level].complexity += weight;
for (const prop of getAllProperties(schema)) {
for (const prop of getAllProperties(schema as ObjectSchema)) {
if (prop.readOnly)
continue;
if (level + 1 < info.length) {
@ -191,39 +191,39 @@ export class FlattenSetter {
private flattenSchemaFromPayload(schema: Schema, curLevel: number, flattenSimpleObject: boolean, flattenConfig: FlattenConfig) {
if (!(schema instanceof ObjectSchema))
if (!Helper.isObjectSchema(schema))
return;
if (curLevel >= flattenConfig.maxLevel) {
const indicator = NodeCliHelper.getSimplifyIndicator(schema);
const indicator = NodeCliHelper.getSimplifyIndicator(schema as ObjectSchema);
// Continue flatten if there is only one property even when we hit the max level
if (indicator.simplifiable !== true || indicator.propertyCountIfSimplify !== 1)
return;
Helper.logDebug(`continue flatten ${schema.language.default.name} when maxLevel is met because it's simplifiyIndicator.propertyCountIfSimplify is ${indicator.propertyCountIfSimplify}`);
}
for (const prop of getAllProperties(schema)) {
for (const prop of getAllProperties(schema as ObjectSchema)) {
if (prop.readOnly)
continue;
if (prop.schema instanceof ObjectSchema) {
if (NodeHelper.HasSubClass(prop.schema)) {
this.flattenPolySchema(prop.schema, NodeCliHelper.getCliKey(prop, "noParamCliKey"), curLevel, flattenSimpleObject, flattenConfig);
if (Helper.isObjectSchema(prop.schema)) {
if (NodeHelper.HasSubClass(prop.schema as ObjectSchema)) {
this.flattenPolySchema(prop.schema as ObjectSchema, NodeCliHelper.getCliKey(prop, "noParamCliKey"), curLevel, flattenSimpleObject, flattenConfig);
}
else if (NodeCliHelper.getInCircle(prop.schema) !== true) {
else if (NodeCliHelper.getInCircle(prop.schema as ObjectSchema) !== true) {
if (flattenSimpleObject ||
NodeCliHelper.getComplexity(prop.schema) !== CliCommonSchema.CodeModel.Complexity.object_simple ||
NodeCliHelper.getSimplifyIndicator(prop.schema).propertyCountIfSimplify == 1) {
NodeCliHelper.getSimplifyIndicator(prop.schema as ObjectSchema).propertyCountIfSimplify == 1) {
NodeExtensionHelper.setFlatten(prop, true, flattenConfig.overwriteSwagger);
}
}
}
else if (prop.schema instanceof ArraySchema) {
if (this.canArrayObjectSimplified(prop.schema.elementType, flattenConfig.maxArrayPropCount)) {
else if (Helper.isArraySchema(prop.schema)) {
if (this.canArrayObjectSimplified((<ArraySchema>prop.schema).elementType, flattenConfig.maxArrayPropCount)) {
// put 32 as max flatten level for array object flatten here just in case,
// it should be big enough value for array object flattening, but handle unexpected circle
// situation though it's not expected
const config = cloneFlattenConfig(flattenConfig);
config.maxLevel = Math.max(32, config.maxLevel);
this.flattenSchemaFromPayload(prop.schema.elementType, curLevel, true, config);
this.flattenSchemaFromPayload((<ArraySchema>prop.schema).elementType, curLevel, true, config);
}
}
this.flattenSchemaFromPayload(prop.schema, curLevel + 1, flattenSimpleObject, flattenConfig);
@ -231,10 +231,10 @@ export class FlattenSetter {
}
private flattenPayload(param: Parameter, flattenConfig: FlattenConfig): void {
if (!(param.schema instanceof ObjectSchema))
if (!Helper.isObjectSchema(param.schema))
return;
if (NodeHelper.HasSubClass(param.schema)) {
this.flattenPolySchema(param.schema, NodeCliHelper.getCliKey(param, "noParamCliKey"), 0, true, flattenConfig);
if (NodeHelper.HasSubClass(param.schema as ObjectSchema)) {
this.flattenPolySchema(param.schema as ObjectSchema, NodeCliHelper.getCliKey(param, "noParamCliKey"), 0, true, flattenConfig);
}
else {
const r = this.calcPayloadFlatten(param.schema, flattenConfig);
@ -256,10 +256,10 @@ export class FlattenSetter {
// by default on when the flatten_all flag is one
if (flattenSchema === true || flattenAll === true) {
this.codeModel.schemas.objects.forEach(o => {
this.codeModel.schemas.objects?.forEach(o => {
if (!NodeHelper.HasSubClass(o)) {
for (const p of getAllProperties(o)) {
if (isObjectSchema(p.schema)) {
if (Helper.isObjectSchema(p.schema)) {
NodeExtensionHelper.setFlatten(p, !NodeHelper.HasSubClass(p.schema as ObjectSchema), overwriteSwagger);
}
}
@ -301,12 +301,12 @@ export class FlattenSetter {
};
if (flattenPayload === true || flattenAll === true) {
this.codeModel.operationGroups.forEach(group => {
this.codeModel.operationGroups?.forEach(group => {
group.operations.forEach(operation => {
values(operation.parameters)
.where(p => p.protocol.http?.in === 'body' && p.implementation === 'Method')
.forEach((p) => {
if (p.schema instanceof ObjectSchema) {
if (Helper.isObjectSchema(p.schema)) {
Helper.logDebug(`Try to set flatten for ${group.language.default.name}/${operation.language.default.name}/${p.language.default.name}`);
flattenConfig.nodeDescripter = {
@ -326,7 +326,7 @@ export class FlattenSetter {
values(request.parameters)
.where(p => p.protocol.http?.in === 'body' && p.implementation === 'Method')
.forEach(p => {
if (p.schema instanceof ObjectSchema) {
if (Helper.isObjectSchema(p.schema)) {
Helper.logDebug(`Try to set flatten for ${group.language.default.name}/${operation.language.default.name}/${p.language.default.name}`);
flattenConfig.nodeDescripter = {

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

@ -1,5 +1,5 @@
import { Session } from "@azure-tools/autorest-extension-base";
import { CodeModel, isObjectSchema, ObjectSchema, Property } from "@azure-tools/codemodel";
import { CodeModel, ObjectSchema, Property } from "@azure-tools/codemodel";
import { isNullOrUndefined } from "util";
import { Helper } from "../../helper";
import { NodeHelper, NodeExtensionHelper } from "../../nodeHelper";
@ -51,7 +51,7 @@ class NodeInfo {
if (!isNullOrUndefined(this.node.properties) && this.node.properties.length > 0) {
for (let i = 0; i < this.node.properties.length; i++) {
const p = this.node.properties[i];
if (isObjectSchema(p.schema)) {
if (Helper.isObjectSchema(p.schema)) {
NodeExtensionHelper.isFlattened(p) ? this.flattenProperty.push(new PropertyInfo(p)) : this.unflattenProperty.push(new PropertyInfo(p));
}
}
@ -125,7 +125,7 @@ export class FlattenValidator {
const result: NodePath[] = [];
const visited = new Set<string>();
objects.forEach(o => {
objects?.forEach(o => {
const ni = new NodeInfo(o);
if (!visited.has(ni.key))
this.visitNode(ni, [], result, visited);

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

@ -1,8 +1,10 @@
import { Host, Session } from "@azure-tools/autorest-extension-base";
import { CodeModel } from "@azure-tools/codemodel";
import { ChoiceSchema, CodeModel, Parameter, SealedChoiceSchema, StringSchema } from "@azure-tools/codemodel";
import { isNullOrUndefined } from "util";
import { Helper } from "../helper";
import { CopyHelper } from "../copyHelper";
import { CliCommonSchema } from "../schema";
import { NodeCliHelper } from "../nodeHelper";
export class ModelerPostProcessor {
@ -10,14 +12,52 @@ export class ModelerPostProcessor {
}
public process(): void {
Helper.enumerateCodeModel(this.session.model, (n) => {
const model = this.session.model;
// In case cli is shared by multiple instances during modelerfour, do deep copy
this.removeCliShare(model);
this.adjustChoiceschema(model);
}
private removeCliShare(model: CodeModel): void {
// In case cli is shared by multiple instances during modelerfour, do deep copy
Helper.enumerateCodeModel(model, (n) => {
if (!isNullOrUndefined(n.target.language['cli'])) {
n.target.language['cli'] = CopyHelper.deepCopy(n.target.language['cli']);
}
});
}
private adjustChoiceschema(model: CodeModel): void {
// For m4 change: https://github.com/Azure/autorest.modelerfour/pull/310/files
// If `modelAsString` is not true, it will no longer be regarded as constant, but choice.
// To make it backward compatiable, for those choices which are constant before(choice.length === 1),
// we give it a default value and set hidden as true.
// The following codegen should handle this case.
// Set schema
Helper.enumerateCodeModel(model, (n) => {
const schema = <ChoiceSchema<StringSchema> | SealedChoiceSchema<StringSchema>>n.target;
if (!isNullOrUndefined(schema.choices) && schema.choices.length === 1) {
NodeCliHelper.setCliDefaultValue(schema, schema.choices[0].value);
NodeCliHelper.setHidden(schema, true);
}
}, CliCommonSchema.CodeModel.NodeTypeFlag.choiceSchema);
// Set parameter according to schema
Helper.enumerateCodeModel(model, (n) => {
const parameter = <Parameter>n.target;
if (!isNullOrUndefined(parameter) && (Helper.isChoiceSchema(parameter.schema) || Helper.isChoiceSchema(parameter.schema))) {
if (NodeCliHelper.getHidden(parameter.schema, false)) {
NodeCliHelper.setHidden(parameter, true);
}
const cliDefaultValue = NodeCliHelper.getCliDefaultValue(parameter.schema);
if (cliDefaultValue !== undefined) {
NodeCliHelper.setCliDefaultValue(parameter, cliDefaultValue);
}
}
}, CliCommonSchema.CodeModel.NodeTypeFlag.parameter);
}
}
export async function processRequest(host: Host): Promise<void> {

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

@ -62,7 +62,7 @@ export class PolyAsParamModifier {
if (isNullOrUndefined(request.parameters))
return;
const allPolyParam: Parameter[] = request.parameters.filter(p =>
p.schema instanceof ObjectSchema &&
Helper.isObjectSchema(p.schema) &&
(p.schema as ObjectSchema).discriminator);
if (allPolyParam.length == 0)
return;
@ -83,16 +83,16 @@ export class PolyAsParamModifier {
for (const key in allSubClass) {
const subClass = allSubClass[key];
if (!(subClass instanceof ObjectSchema)) {
if (!Helper.isObjectSchema(subClass)) {
Helper.logWarning("subclass is not ObjectSchema: " + subClass.language.default.name);
continue;
}
if (NodeHelper.HasSubClass(subClass)) {
if (NodeHelper.HasSubClass(subClass as ObjectSchema)) {
Helper.logWarning("skip subclass which also has subclass: " + subClass.language.default.name);
continue;
}
const param2: Parameter = this.cloneParamForSubclass(polyParam, this.buildSubclassParamName(polyParam, key), subClass);
const param2: Parameter = this.cloneParamForSubclass(polyParam, this.buildSubclassParamName(polyParam, key), subClass as ObjectSchema);
NodeExtensionHelper.setPolyAsParamOriginalParam(param2, polyParam);
request.addParameter(param2);
}

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

@ -129,7 +129,7 @@ export class PolyAsResourceModifier {
return [];
}
return request.parameters?.filter(p =>
p.schema instanceof ObjectSchema && (p.schema as ObjectSchema).discriminator && NodeCliHelper.isPolyAsResource(p));
Helper.isObjectSchema(p.schema) && (p.schema as ObjectSchema).discriminator && NodeCliHelper.isPolyAsResource(p));
}
private getDefaultRequest(operation: Operation): Request {

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

@ -1,5 +1,5 @@
import { Host, Session } from "@azure-tools/autorest-extension-base";
import { CodeModel, ObjectSchema, isObjectSchema, Parameter, ArraySchema, DictionarySchema, ConstantSchema } from "@azure-tools/codemodel";
import { CodeModel, ObjectSchema, Parameter } from "@azure-tools/codemodel";
import { Helper } from "../helper";
import { CliCommonSchema } from "../schema";
import { NodeHelper, NodeCliHelper } from "../nodeHelper";
@ -32,14 +32,14 @@ class VisibilityCleaner {
for (const prop of schema.properties) {
if (!NodeHelper.checkVisibility(prop))
continue;
if (isObjectSchema(prop.schema)) {
if (this.calcObject(prop.schema) === CliCommonSchema.CodeModel.Visibility.true)
if (Helper.isObjectSchema(prop.schema)) {
if (this.calcObject(prop.schema as ObjectSchema) === CliCommonSchema.CodeModel.Visibility.true)
visible = CliCommonSchema.CodeModel.Visibility.true;
}
else if ((prop.schema instanceof ArraySchema || prop.schema instanceof DictionarySchema)) {
else if (Helper.isArraySchema(prop.schema) || Helper.isDictionarySchema(prop.schema)) {
visible = CliCommonSchema.CodeModel.Visibility.true;
}
else if (prop.schema instanceof ConstantSchema) {
else if (Helper.isConstantSchema(prop.schema)) {
// do nothing here
}
else {
@ -71,8 +71,8 @@ class VisibilityCleaner {
});
Helper.enumerateCodeModel(this.session.model, (descriptor) => {
if (descriptor.target instanceof Parameter) {
if (NodeCliHelper.getIsVisibleFlag(descriptor.target.schema) === CliCommonSchema.CodeModel.Visibility.false) {
if (Helper.isParameter(descriptor.target)) {
if (NodeCliHelper.getIsVisibleFlag((<Parameter>descriptor.target).schema) === CliCommonSchema.CodeModel.Visibility.false) {
NodeCliHelper.setHidden(descriptor.target, true);
NodeCliHelper.setIsVisibleFlag(descriptor.target, CliCommonSchema.CodeModel.Visibility.false);
}

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

@ -2984,6 +2984,8 @@ schemas:
- choiceName: factory_identity_type
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: system_assigned
cli:

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

@ -1713,6 +1713,8 @@ schemas:
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -2984,6 +2984,8 @@ schemas:
- choiceName: factory_identity_type
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: system_assigned
cli:

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

@ -1713,6 +1713,8 @@ schemas:
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -2984,6 +2984,8 @@ schemas:
- choiceName: factory_identity_type
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: system_assigned
cli:

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

@ -1713,6 +1713,8 @@ schemas:
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -2984,6 +2984,8 @@ schemas:
- choiceName: factory_identity_type
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: system_assigned
cli:

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

@ -1713,6 +1713,8 @@ schemas:
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -2984,6 +2984,8 @@ schemas:
- choiceName: factory_identity_type
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: system_assigned
cli:

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

@ -1713,6 +1713,8 @@ schemas:
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -2984,6 +2984,8 @@ schemas:
- choiceName: factory_identity_type
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: system_assigned
cli:

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

@ -1713,6 +1713,8 @@ schemas:
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -2984,6 +2984,8 @@ schemas:
- choiceName: factory_identity_type
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: system_assigned
cli:

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

@ -1713,6 +1713,8 @@ schemas:
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -3020,6 +3020,8 @@ schemas:
- choiceName: FactoryIdentityType
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: SystemAssigned
cli:

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

@ -2264,6 +2264,8 @@ schemas:
name: FactoryIdentityType
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -3020,6 +3020,8 @@ schemas:
- choiceName: FactoryIdentityType
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: SystemAssigned
cli:

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

@ -2264,6 +2264,8 @@ schemas:
name: FactoryIdentityType
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -3020,6 +3020,8 @@ schemas:
- choiceName: FactoryIdentityType
cli:
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
choiceValues:
- choiceValue: SystemAssigned
cli:

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

@ -2264,6 +2264,8 @@ schemas:
name: FactoryIdentityType
description: The identity type. Currently the only supported type is 'SystemAssigned'.
cliKey: FactoryIdentityType
default-value: SystemAssigned
hidden: true
protocol: {}
- &ref_180
choices:

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

@ -851,6 +851,8 @@ schemas:
- choiceName: kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: connectivity
cli:

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

@ -263,6 +263,8 @@ schemas:
description: Responsibility role under which this Managed Network Group will be created
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices:

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

@ -851,6 +851,8 @@ schemas:
- choiceName: kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: connectivity
cli:

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

@ -263,6 +263,8 @@ schemas:
description: Responsibility role under which this Managed Network Group will be created
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices:

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

@ -851,6 +851,8 @@ schemas:
- choiceName: kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: connectivity
cli:

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

@ -263,6 +263,8 @@ schemas:
description: Responsibility role under which this Managed Network Group will be created
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices:

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

@ -851,6 +851,8 @@ schemas:
- choiceName: kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: connectivity
cli:

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

@ -263,6 +263,8 @@ schemas:
description: Responsibility role under which this Managed Network Group will be created
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices:

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

@ -851,6 +851,8 @@ schemas:
- choiceName: kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: connectivity
cli:

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

@ -263,6 +263,8 @@ schemas:
description: Responsibility role under which this Managed Network Group will be created
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices:

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

@ -851,6 +851,8 @@ schemas:
- choiceName: kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: connectivity
cli:

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

@ -263,6 +263,8 @@ schemas:
description: Responsibility role under which this Managed Network Group will be created
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices:

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

@ -851,6 +851,8 @@ schemas:
- choiceName: kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: connectivity
cli:

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

@ -263,6 +263,8 @@ schemas:
description: Responsibility role under which this Managed Network Group will be created
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices:

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

@ -859,6 +859,8 @@ schemas:
- choiceName: Kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: Connectivity
cli:

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

@ -340,6 +340,8 @@ schemas:
name: Kind
description: Responsibility role under which this Managed Network Group will be created
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices:

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

@ -859,6 +859,8 @@ schemas:
- choiceName: Kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: Connectivity
cli:

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

@ -340,6 +340,8 @@ schemas:
name: Kind
description: Responsibility role under which this Managed Network Group will be created
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices:

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

@ -859,6 +859,8 @@ schemas:
- choiceName: Kind
cli:
cliKey: Kind
default-value: Connectivity
hidden: true
choiceValues:
- choiceValue: Connectivity
cli:

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

@ -340,6 +340,8 @@ schemas:
name: Kind
description: Responsibility role under which this Managed Network Group will be created
cliKey: Kind
default-value: Connectivity
hidden: true
protocol: {}
- &ref_9
choices: