Skip to content

Commit

Permalink
fixed PR #75
Browse files Browse the repository at this point in the history
  • Loading branch information
Wicpar committed Sep 15, 2020
1 parent 947aad8 commit 418ba02
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ class ModularParameterHandler<T>(val parsers: Map<KParameter, Builder<*>>, val c

override fun parse(parameters: Parameters, headers: Headers): T {
return constructor.callBy(parsers.mapValues {
it.value.build(it.key.name.toString(), it.key.remapOpenAPINames(parameters.toMap() + headers.toMap()))
?: throw OpenAPIRequiredFieldException("""The field ${it.key.openAPIName ?: "unknow field"} is required""")
val value = it.value.build(it.key.name.toString(), it.key.remapOpenAPINames(parameters.toMap() + headers.toMap()))
if (value != null || it.key.type.isMarkedNullable) {
value
} else {
throw OpenAPIRequiredFieldException("""The field ${it.key.openAPIName ?: "unknow field"} is required""")
}
})
}

Expand Down

0 comments on commit 418ba02

Please sign in to comment.