Skip to content

Commit

Permalink
Merge commit 'refs/pull/51/head' of https://github.com/hackolade/Avro
Browse files Browse the repository at this point in the history
  • Loading branch information
pdesmarets committed Dec 20, 2021
2 parents 21bc5b3 + 5adcbe5 commit d2d447a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions forward_engineering/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,14 +696,17 @@ const handleChoice = (schema, choice, udt) => {
multipleField.type.push(newField);
} else if (Object(newField.type) === newField.type) {
newField.name = newField.name || field.name || fieldName;
multipleField.type = multipleField.type.concat([newField]);
const type = _.isArray(newField.type)
? _.map(newField.type, type => _.assign({}, newField, { type }))
: [newField];
multipleField.type = multipleField.type.concat(type);
} else if (Array.isArray(filedType)) {
multipleField.type = multipleField.type.concat(filedType);
} else {
multipleField.type = multipleField.type.concat([filedType]);
}

multipleField.type = _.uniq(multipleField.type);
multipleField.type = _.uniqBy(multipleField.type, type => (_.isObject(type) ? type.type : type));
if (multipleField.type.length === 1) {
multipleField.type = _.first(multipleField.type);
}
Expand Down

0 comments on commit d2d447a

Please sign in to comment.