Skip to content

Commit

Permalink
fix(reflection): detect JSON properties defined with Record or `Dic…
Browse files Browse the repository at this point in the history
…tionary` types

Related: #4755
  • Loading branch information
B4nan committed Sep 30, 2023
1 parent b38a327 commit 62740d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/reflection/src/TsMorphMetadataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export class TsMorphMetadataProvider extends MetadataProvider {
this.processWrapper(prop, 'Reference');
this.processWrapper(prop, 'Ref');
this.processWrapper(prop, 'Collection');

if (prop.type.replace(/import\(.*\)\./g, '').match(/^(Dictionary|Record)<.*>$/)) {
prop.type = 'json';
}
}

private async readTypeFromSource(meta: EntityMetadata, prop: EntityProperty): Promise<{ type: string; optional?: boolean }> {
Expand Down

0 comments on commit 62740d1

Please sign in to comment.