Skip to content

Commit

Permalink
Merge pull request #2564 from benjaballah/master-1
Browse files Browse the repository at this point in the history
Update schema-object-factory.ts
  • Loading branch information
kamilmysliwiec authored Sep 11, 2023
2 parents dd036b8 + f06c1c8 commit 1b43460
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 1b43460

Please sign in to comment.