Skip to content

Commit 3c020aa

Browse files
committed
simpler
1 parent e6cd0bd commit 3c020aa

File tree

1 file changed

+14
-33
lines changed

1 file changed

+14
-33
lines changed

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/writer/java/BeanValidationFactory.kt

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -177,47 +177,28 @@ open class BeanValidationFactory(
177177
}
178178

179179
private fun DataType.shouldHaveValid(options: ApiOptions): Boolean {
180-
if (options.beanValidationValidOnReactive) {
181-
if (this is SingleDataType)
182-
return true
180+
if (this is SingleDataType && options.beanValidationValidOnReactive)
181+
return true
183182

184-
if (this is ModelDataType)
185-
return true
183+
if (this is ModelDataType)
184+
return true
186185

187-
if (this is ArrayDataType)
188-
return item is ModelDataType
186+
if (this is ArrayDataType)
187+
return item is ModelDataType
189188

190-
if (this is InterfaceDataType)
191-
return true
189+
if (this is InterfaceDataType)
190+
return true
192191

193-
if (this is MappedCollectionDataType)
194-
return multi
195-
196-
if (this is MappedSourceDataType) {
197-
return sourceDataType?.shouldHaveValid(options) ?: false
198-
}
192+
if (this is MappedCollectionDataType && options.beanValidationValidOnReactive)
193+
return multi
199194

195+
if (this is MappedCollectionDataType)
200196
return false
201197

202-
} else {
203-
if (this is ModelDataType)
204-
return true
205-
206-
if (this is ArrayDataType)
207-
return item is ModelDataType
208-
209-
if (this is InterfaceDataType)
210-
return true
211-
212-
if (this is MappedCollectionDataType)
213-
return false
198+
if (this is MappedSourceDataType)
199+
return sourceDataType?.shouldHaveValid(options) ?: false
214200

215-
if (this is MappedSourceDataType) {
216-
return sourceDataType?.shouldHaveValid(options) ?: false
217-
}
218-
219-
return false
220-
}
201+
return false
221202
}
222203

223204
private fun DataType.isString(): Boolean = this is StringDataType

0 commit comments

Comments
 (0)