File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -137,21 +137,28 @@ function dto2struct(dto) {
137
137
let globalDtoCounter = 0
138
138
139
139
const dtoCache = {}
140
+ const namedDtoCache = {}
141
+
140
142
function cacheDto (dto ) {
141
- dtoCache[dto .signature ] = dto .name
143
+ if (dto .hasUserProvidedName ) {
144
+ namedDtoCache[dto .signature ] = dto .name
145
+ } else {
146
+ dtoCache[dto .signature ] = dto .name
147
+ }
142
148
return dto
143
149
}
150
+
144
151
function dtoInCache (dto ) {
145
- // always prefer user specified name even when we have a similar DTO in cache
152
+ // always prefer user specified name even when we have a similar DTO in cache for generated names
146
153
if (dto .hasUserProvidedName ) {
147
- return false
154
+ return namedDtoCache . hasOwnProperty ( dto . signature )
148
155
}
149
156
return dtoCache .hasOwnProperty (dto .signature )
150
157
}
151
158
152
159
function obtainDtoName (dto ) {
153
- const cacheKey = dto ? dto .signature : null
154
- return dtoInCache (dto ) ? dtoCache [cacheKey] : dto .name
160
+ const cacheKey = dto .signature
161
+ return namedDtoCache . hasOwnProperty (cacheKey ) ? namedDtoCache [cacheKey] : dto .name
155
162
}
156
163
157
164
const verbs_with_dto = [ ' get' , ' post' , ' put' ]
You can’t perform that action at this time.
0 commit comments