File tree Expand file tree Collapse file tree 2 files changed +19
-15
lines changed
Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -4,14 +4,12 @@ import { IsString } from 'class-validator'
44import { validationMetadatasToSchemas } from '../src'
55const { defaultMetadataStorage } = require ( 'class-transformer/cjs/storage' )
66
7-
8-
97// @ts -ignore unused
10- class User {
8+ class User {
119 @IsString ( )
1210 id : string
1311
14- @Expose ( { name : 'domain_id' } )
12+ @Expose ( { name : 'domain_id' } )
1513 @IsString ( )
1614 domainId : string
1715}
Original file line number Diff line number Diff line change @@ -64,20 +64,26 @@ export function validationMetadataArrayToSchemas(
6464 isExcluded ( propMeta , options ) ||
6565 isExcluded ( { ...propMeta , target } , options )
6666 )
67- ) . map ( ( propMeta ) => {
68- /**
69- * Retrieves all properties that have the Expose decorator from class-transformer
70- * and remaps the property names to the names exposed by the Expose decorator.
71- */
72- const exposeMetadata = userOptions ?. classTransformerMetadataStorage ?. getExposedMetadatas ( propMeta . target as any )
67+ )
68+ . map ( ( propMeta ) => {
69+ /**
70+ * Retrieves all properties that have the Expose decorator from class-transformer
71+ * and remaps the property names to the names exposed by the Expose decorator.
72+ */
73+ const exposeMetadata =
74+ userOptions ?. classTransformerMetadataStorage ?. getExposedMetadatas (
75+ propMeta . target as any
76+ )
7377
74- const ctMetaForField = ctMetadata ?. find ( ( meta : ExposeMetadata ) => meta . propertyName == propMeta . propertyName )
78+ const ctMetaForField = exposeMetadata ?. find (
79+ ( meta : ExposeMetadata ) => meta . propertyName === propMeta . propertyName
80+ )
7581
76- if ( ctMetaForField ?. options . name ) {
77- propMeta . propertyName = ctMetaForField . options . name ;
78- }
82+ if ( ctMetaForField ?. options . name ) {
83+ propMeta . propertyName = ctMetaForField . options . name
84+ }
7985
80- return propMeta
86+ return propMeta
8187 } )
8288
8389 const properties : { [ name : string ] : ReferenceObject | SchemaObject } = { }
You can’t perform that action at this time.
0 commit comments