Skip to content

Commit

Permalink
fix: missing properties when using complex allOf (regression)
Browse files Browse the repository at this point in the history
fixes #422
  • Loading branch information
RomanHotsiy committed Feb 26, 2018
1 parent 92ed914 commit 6ce9245
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 9 additions & 0 deletions lib/services/schema-normalizer.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,15 @@ describe('Spec Helper', () => {
Object.keys(joined.properties).should.be.deepEqual(['prop1', 'prop2', 'prop3', 'prop4']);
joined.required.should.be.deepEqual(['prop1', 'prop3']);
});

it('should handle nested allOf if already cached', () => {
let pointer = '/definitions/NestedAllOf';
let joined;
(() => joined = normalizer.normalize(specMgr.byPointer(pointer), pointer)).should.not.throw();
Object.keys(joined.properties).length.should.be.equal(4);
Object.keys(joined.properties).should.be.deepEqual(['prop1', 'prop2', 'prop3', 'prop4']);
joined.required.should.be.deepEqual(['prop1', 'prop3']);
});
});

xdescribe('Merge array allOf', () => {
Expand Down
5 changes: 2 additions & 3 deletions lib/services/schema-normalizer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class SchemaWalker {
}

if (obj['x-redoc-visited']) {
const res = visitor(obj, pointer);
obj['x-redoc-visited'] = false;
const res = visitor(obj, pointer);
// circular, return only title and description
return { title: res.title, description: res.description };
}
Expand Down Expand Up @@ -92,9 +92,8 @@ class SchemaWalker {
}
}

const res = visitor(obj, pointer);
obj['x-redoc-visited'] = false;
return res;
return visitor(obj, pointer);
}

private static walkEach(obj:Object, pointer:string, visitor:Function) {
Expand Down

0 comments on commit 6ce9245

Please sign in to comment.