Skip to content

Commit

Permalink
fixed internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
christianblos committed Jun 6, 2018
1 parent 0adcafd commit 0a15356
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/domain/helpers/jsonSchema/setRequiredBoolDefaultValues.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function setRequiredBoolDefaultValues(data: any, schema: any): any {
if (schema.type == 'object') {
if (schema.type == 'object' && data) {
let required: string[] = schema.required || [];

if (schema.properties) {
Expand All @@ -15,7 +15,7 @@ export function setRequiredBoolDefaultValues(data: any, schema: any): any {
data = {...data, [prop]: val};
});
}
} else if (schema.type == 'array') {
} else if (schema.type == 'array' && Array.isArray(data)) {
data = (data as any[])
.map((item): any => {
if (schema.items) {
Expand Down

0 comments on commit 0a15356

Please sign in to comment.