Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Commit

Permalink
improve visibility cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
RodgeFu committed May 16, 2020
1 parent 3e217d6 commit 06dda80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/plugins/flattenSetter/flattenSetter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export class FlattenSetter {
if (prop.schema instanceof ObjectSchema) {
if (NodeHelper.HasSubClass(prop.schema) !== true && NodeHelper.getInCircle(prop.schema) !== true) {
NodeHelper.setFlatten(prop, true, flattenConfig.overwriteSwagger);
Helper.logDebug("single property schema to flatten: " + schema.language.default.name);
this.flattenSchemaWithSingleProperty(prop.schema, flattenConfig);
}
}
Expand Down
12 changes: 11 additions & 1 deletion src/plugins/visibilityCleaner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Host, Session, startSession } from "@azure-tools/autorest-extension-base";
import { CodeModel, Request, codeModelSchema, Metadata, ObjectSchema, isObjectSchema, Property, Extensions, Scheme, ComplexSchema, Operation, OperationGroup, Parameter, VirtualParameter, ImplementationLocation, ArraySchema, DictionarySchema, ConstantSchema } from "@azure-tools/codemodel";
import { CodeModel, Request, codeModelSchema, Metadata, ObjectSchema, isObjectSchema, Property, Extensions, Scheme, ComplexSchema, Operation, OperationGroup, Parameter, VirtualParameter, ImplementationLocation, ArraySchema, DictionarySchema, ConstantSchema, getAllProperties } from "@azure-tools/codemodel";
import { isNullOrUndefined, isArray, isNull } from "util";
import { Helper } from "../helper";
import { CliConst, M4Node, CliCommonSchema } from "../schema";
Expand Down Expand Up @@ -52,6 +52,16 @@ class VisibilityCleaner {
}
}
}

if (visible === CliCommonSchema.CodeModel.Visibility.false) {
if (NodeHelper.HasSubClass(schema)) {
for (let subClass of NodeHelper.getSubClasses(schema, true)) {
if (this.calcObject(subClass) === CliCommonSchema.CodeModel.Visibility.true)
visible = CliCommonSchema.CodeModel.Visibility.true;
}
}
}

NodeHelper.setIsVisibleFlag(schema, visible);
return visible;
}
Expand Down

0 comments on commit 06dda80

Please sign in to comment.