Skip to content

Commit

Permalink
Merge pull request #2952 from voriteam/clintonb/name-bug
Browse files Browse the repository at this point in the history
fix: Retain $ref when setting name property
  • Loading branch information
kamilmysliwiec authored Jul 1, 2024
2 parents d0a58e0 + 94f565c commit a57f853
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/services/schema-object-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export class SchemaObjectFactory {
if (metadata.isArray) {
return this.transformToArraySchemaProperty(metadata, key, { $ref });
}
const keysToRemove = ['type', 'isArray', 'required'];
const keysToRemove = ['type', 'isArray', 'required', 'name'];
const validMetadataObject = omit(metadata, keysToRemove);
const extraMetadataKeys = Object.keys(validMetadataObject);

Expand Down
3 changes: 2 additions & 1 deletion test/services/fixtures/create-profile.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export class CreateProfileDto {
lastname: string;

@ApiProperty({
type: () => CreateUserDto
type: () => CreateUserDto,
name: 'parent'
})
parent: CreateUserDto;
}

0 comments on commit a57f853

Please sign in to comment.