Skip to content

Commit

Permalink
fix(core): ignore rest parameter in entity.toJSON()
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Apr 7, 2019
1 parent 8c9ee4d commit 147de7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/metadata/MetadataDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class MetadataDiscovery {
const meta = MetadataStorage.getMetadata(entity.name);
meta.prototype = entity.prototype;
meta.path = path || meta.path;
meta.toJsonParams = Utils.getParamNames(entity.prototype.toJSON || '');
meta.toJsonParams = Utils.getParamNames(entity.prototype.toJSON || '').filter(p => p !== '...args');
const cache = meta.path && this.cache.get(entity.name + extname(meta.path));

if (cache) {
Expand Down
1 change: 1 addition & 0 deletions tests/EntityFactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('EntityFactory', () => {
expect(metadata[BaseEntity.name].properties['foo'].type).toBe('string');
expect(metadata[Author.name]).toBeInstanceOf(Object);
expect(metadata[Author.name].path).toBe(__dirname + '/entities/Author.ts');
expect(metadata[Author.name].toJsonParams).toEqual(['strict', 'strip']);
expect(metadata[Author.name].properties).toBeInstanceOf(Object);
expect(metadata[Author.name].properties['books'].type).toBe(Book.name);
expect(metadata[Author.name].properties['books'].reference).toBe(ReferenceType.ONE_TO_MANY);
Expand Down

0 comments on commit 147de7d

Please sign in to comment.