init security scheme (#29)

This commit is contained in:
dpnolte
2021-04-21 19:51:42 +02:00
committed by GitHub
parent 8a64925c9d
commit d0767aa74e
21 changed files with 835 additions and 9 deletions

View File

@ -101,7 +101,11 @@ object Kompendium {
deprecated = this.deprecated,
parameters = paramType.toParameterSpec(),
responses = responseType.toResponseSpec(responseInfo)?.let { mapOf(it) },
requestBody = if (method != HttpMethod.Get) requestType.toRequestSpec(requestInfo) else null
requestBody = if (method != HttpMethod.Get) requestType.toRequestSpec(requestInfo) else null,
security = if (this.securitySchemes.isNotEmpty()) listOf(
// TODO support scopes
this.securitySchemes.associateWith { listOf() }
) else null
)
@OptIn(ExperimentalStdlibApi::class)

View File

@ -7,5 +7,6 @@ data class MethodInfo(
val responseInfo: ResponseInfo? = null,
val requestInfo: RequestInfo? = null,
val tags: Set<String> = emptySet(),
val deprecated: Boolean = false
val deprecated: Boolean = false,
val securitySchemes: Set<String> = emptySet()
)

View File

@ -3,5 +3,5 @@ package org.leafygreens.kompendium.models.oas
// TODO I *think* the only thing I need here is the security https://swagger.io/specification/#components-object
data class OpenApiSpecComponents(
val schemas: MutableMap<String, OpenApiSpecComponentSchema> = mutableMapOf(),
val securitySchemes: MutableMap<String, OpenApiSpecSchema> = mutableMapOf()
val securitySchemes: MutableMap<String, OpenApiSpecSchemaSecurity> = mutableMapOf()
)