Skip to content

Commit cc4c77d

Browse files
committed
simpler
1 parent 3c020aa commit cc4c77d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

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

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

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

183-
if (this is ModelDataType)
184-
return true
183+
else if (this is ModelDataType)
184+
true
185185

186-
if (this is ArrayDataType)
187-
return item is ModelDataType
186+
else if (this is ArrayDataType)
187+
item is ModelDataType
188188

189-
if (this is InterfaceDataType)
190-
return true
189+
else if (this is InterfaceDataType)
190+
true
191191

192-
if (this is MappedCollectionDataType && options.beanValidationValidOnReactive)
193-
return multi
192+
else if (this is MappedCollectionDataType && options.beanValidationValidOnReactive)
193+
multi
194194

195-
if (this is MappedCollectionDataType)
196-
return false
195+
else if (this is MappedCollectionDataType)
196+
false
197197

198-
if (this is MappedSourceDataType)
199-
return sourceDataType?.shouldHaveValid(options) ?: false
198+
else if (this is MappedSourceDataType)
199+
sourceDataType?.shouldHaveValid(options) ?: false
200200

201-
return false
201+
else
202+
false
202203
}
203204

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

0 commit comments

Comments
 (0)