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

Commit

Permalink
Fix flattenedNames issue (#102)
Browse files Browse the repository at this point in the history
* Fix flattenedNames issue

* version bump

Co-authored-by: Xiao Chen <[email protected]>
  • Loading branch information
shawncx and msxichen authored Nov 12, 2020
1 parent 209df41 commit a6e6fc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@autorest/clicommon",
"version": "0.5.6",
"version": "0.5.7",
"description": "Autorest Azure Cli Common Module",
"main": "dist/index.js",
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions src/flattener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ export class Flattener {
// remove that property from the scheama
schema.properties.splice(index, 1);

// copy all of the properties from the child into this
// schema
// copy all of the properties from the child into this schema
for (const childProperty of values(getAllProperties(property.schema))) {
const parentFlattenedNames = property.flattenedNames ?? [property.serializedName];
const newProp = new Property(childProperty.language.default.name, childProperty.language.default.description, childProperty.schema, {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...(<any>childProperty),
flattenedNames: [property.serializedName, ...childProperty.flattenedNames ? childProperty.flattenedNames : [childProperty.serializedName]],
flattenedNames: [...parentFlattenedNames, ...childProperty.flattenedNames ? childProperty.flattenedNames : [childProperty.serializedName]],
required: property.required && childProperty.required
});
schema.addProperty(newProp);
Expand Down

0 comments on commit a6e6fc3

Please sign in to comment.