chore: clean up some bad habits

This commit is contained in:
Ryan Brink
2022-08-16 19:11:42 -06:00
parent 3326f10576
commit db696309c8
11 changed files with 32 additions and 29 deletions

View File

@ -25,11 +25,11 @@ class DeleteInfo private constructor(
class Builder : MethodInfo.Builder<DeleteInfo>() {
override fun build() = DeleteInfo(
response = response!!,
response = response ?: error("Response info must be present"),
errors = errors,
tags = tags,
summary = summary!!,
description = description!!,
summary = summary ?: error("Summary must be present"),
description = description ?: error("Description must be present"),
externalDocumentation = externalDocumentation,
operationId = operationId,
deprecated = deprecated,

View File

@ -25,11 +25,11 @@ class HeadInfo private constructor(
class Builder : MethodInfo.Builder<HeadInfo>() {
override fun build() = HeadInfo(
response = response!!,
response = response ?: error("Response info must be present"),
errors = errors,
tags = tags,
summary = summary!!,
description = description!!,
summary = summary ?: error("Summary must be present"),
description = description ?: error("Description must be present"),
externalDocumentation = externalDocumentation,
operationId = operationId,
deprecated = deprecated,

View File

@ -25,11 +25,11 @@ class OptionsInfo private constructor(
class Builder : MethodInfo.Builder<OptionsInfo>() {
override fun build() = OptionsInfo(
response = response!!,
response = response ?: error("Response info must be provided!"),
errors = errors,
tags = tags,
summary = summary!!,
description = description!!,
summary = summary ?: error("Summary must be provided!"),
description = description ?: error("Description must be provided!"),
externalDocumentation = externalDocumentation,
operationId = operationId,
deprecated = deprecated,

View File

@ -26,12 +26,12 @@ class PatchInfo private constructor(
class Builder : MethodInfoWithRequest.Builder<PatchInfo>() {
override fun build() = PatchInfo(
request = request!!,
request = request ?: error("request info must be present"),
errors = errors,
response = response!!,
response = response ?: error("response info must be present"),
tags = tags,
summary = summary!!,
description = description!!,
summary = summary ?: error("Summary must be present"),
description = description ?: error("Description must be present"),
externalDocumentation = externalDocumentation,
operationId = operationId,
deprecated = deprecated,

View File

@ -26,12 +26,12 @@ class PostInfo private constructor(
class Builder : MethodInfoWithRequest.Builder<PostInfo>() {
override fun build() = PostInfo(
request = request!!,
request = request ?: error("request info must be present"),
errors = errors,
response = response!!,
response = response ?: error("response info must be present"),
tags = tags,
summary = summary!!,
description = description!!,
summary = summary ?: error("Summary must be present"),
description = description ?: error("Description must be present"),
externalDocumentation = externalDocumentation,
operationId = operationId,
deprecated = deprecated,

View File

@ -26,12 +26,12 @@ class PutInfo private constructor(
class Builder : MethodInfoWithRequest.Builder<PutInfo>() {
override fun build() = PutInfo(
request = request!!,
request = request ?: error("request info must be present"),
errors = errors,
response = response!!,
response = response ?: error("response info must be present"),
tags = tags,
summary = summary!!,
description = description!!,
summary = summary ?: error("Summary must be present"),
description = description ?: error("Description must be present"),
externalDocumentation = externalDocumentation,
operationId = operationId,
deprecated = deprecated,

View File

@ -37,8 +37,8 @@ class RequestInfo private constructor(
}
fun build() = RequestInfo(
requestType = requestType!!,
description = description!!,
requestType = requestType ?: error("Request type must be present"),
description = description ?: error("Description must be present"),
examples = examples
)
}

View File

@ -55,7 +55,8 @@ object NotarizedRoute {
Please make sure that all notarized paths are unique
""".trimIndent()
}
spec.paths[routePath] = pluginConfig.path!!
spec.paths[routePath] = pluginConfig.path
?: error("This indicates a bug in Kompendium. Please file a GitHub issue!")
}
val spec = application.attributes[KompendiumAttributes.openApiSpec]