DefaultMethodParser

object DefaultMethodParser : IMethodParser

Functions

Link copied to clipboard
open fun Route.calculateRoutePath(): String

Uses the built-in Ktor route path Route.toString but cuts out any meta route such as authentication... anything that matches the RegEx pattern /\\(.+\\)

Link copied to clipboard
open fun defaultValueInjector(param: KParameter): Any

Allows the reflection invoker to populate a parameter map with values in order to sus out any default parameters.

Link copied to clipboard
open fun getDefaultParameterValue(clazz: KClass<*>, prop: KProperty<*>): Any?

Absolutely disgusting reflection to determine if a default value is available for a given property.

Link copied to clipboard
open fun Set<ParameterExample>.mapToSpec(parameterName: String): Map<String, Parameter.Example>?
Link copied to clipboard
open fun parseExceptions(exceptionInfo: Set<ExceptionInfo<*>>, feature: Kompendium): Map<Int, Response>
Link copied to clipboard
open fun parseMethodInfo(info: MethodInfo<*, *>, paramType: KType, requestType: KType, responseType: KType, feature: Kompendium): PathOperation

Generates the OpenAPI Path spec from provided metadata

Link copied to clipboard
open fun parseResponse(responseType: KType, responseInfo: ResponseInfo<*>?, feature: Kompendium): Map<Int, Response>
Link copied to clipboard
open fun Kompendium.resolveContent(type: KType, mediaTypes: List<String>, examples: Map<String, Any>): Map<String, MediaType>?

Generates MediaTypes along with any examples provided

Link copied to clipboard
open fun KProperty<*>.toParameter(info: MethodInfo<*, *>, parentType: KType, parentClazz: KClass<*>, feature: Kompendium): Parameter
Link copied to clipboard
open fun KType.toParameterSpec(info: MethodInfo<*, *>, feature: Kompendium): List<Parameter>

Parses a type for all parameter information. All fields in the receiver must be annotated with io.bkbn.kompendium.annotations.Param.

Link copied to clipboard
open fun KType.toRequestSpec(requestInfo: RequestInfo<*>?, feature: Kompendium): Request?

Converts a KType to an Request

Link copied to clipboard
open fun KType.toResponseSpec(responseInfo: ResponseInfo<*>?, feature: Kompendium): Pair<Int, Response>?

Converts a KType to a pairing of http status code to Response