Skip to content

Array of objects json export reviwed#579

Open
JuanBerrocal wants to merge 6 commits intoLemoncode:vnextfrom
JuanBerrocal:bug/#562-schema-export-does-not-include-nested-properties-for-array-object-items
Open

Array of objects json export reviwed#579
JuanBerrocal wants to merge 6 commits intoLemoncode:vnextfrom
JuanBerrocal:bug/#562-schema-export-does-not-include-nested-properties-for-array-object-items

Conversation

@JuanBerrocal
Copy link
Collaborator

I looked into this issue. The problem was that the array of objects are never processed.
In the file: src\pods\toolbar\components\export-button\export-button.business.ts
This function: getPropertyJsonSchema suposses that every array is made up of base type items.
When an array is found, always made this:
return "${field.name}": { bsonType: "array", items: ${field.type} };
So if an object is the item of an array, always returns:
return "${field.name}": { bsonType: "array", items: "object" };
But doesnt return any property from the object.
To resolve this I've used a new function, getItemType.
This function process every item from the array and make a recursive call on getPropertiesJsonSchema if necessary.
So nested objects are also treated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant