Skip to content

Commit

Permalink
Update schema-object-factory.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaballah authored Aug 10, 2023
1 parent 931890d commit f06c1c8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/services/schema-object-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,15 @@ export class SchemaObjectFactory {
);

const schemaCombinators = ['oneOf', 'anyOf', 'allOf'];
if (schemaCombinators.some((key) => key in property)) {
delete (property as SchemaObjectMetadata).type;
let keyOfCombinators = '';
if (schemaCombinators.some((_key) => { keyOfCombinators = _key; return _key in property; })) {
if (((property as SchemaObjectMetadata)?.type === 'array' || (property as SchemaObjectMetadata).isArray) && keyOfCombinators) {
(property as SchemaObjectMetadata).items = {};
(property as SchemaObjectMetadata).items[keyOfCombinators] = property[keyOfCombinators];
delete property[keyOfCombinators];
} else {
delete (property as SchemaObjectMetadata).type;
}
}
return property as ParameterObject;
});
Expand Down

0 comments on commit f06c1c8

Please sign in to comment.