Skip to content

Commit

Permalink
fixed exception model not generating example
Browse files Browse the repository at this point in the history
  • Loading branch information
Wicpar committed Mar 20, 2020
1 parent 26f9dd1 commit a02ba29
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ object ThrowOperationHandler : OperationModule {
schemas.size == 1 -> schemas.first()
else -> SchemaModel.OneSchemaModelOf(schemas)
}
MediaTypeModel(schema)
val examples = it.value.mapNotNull { (_, second) -> second.example }.withIndex().associate { (idx, value) -> "Example $idx" to value }.toMutableMap()
if (examples.size <= 1) {
MediaTypeModel(schema, example = examples.values.firstOrNull())
} else {
MediaTypeModel(schema, examples = examples)
}
}.toMutableMap()
val statusCode = exceptions.key
val status = statusCode.value.toString()
Expand Down

0 comments on commit a02ba29

Please sign in to comment.