feat: moving request and response to references (#181)

This commit is contained in:
Ryan Brink
2022-02-18 00:11:58 -05:00
committed by GitHub
parent 69d6b1af1d
commit 558824003b
73 changed files with 1609 additions and 1296 deletions

View File

@ -3,7 +3,6 @@
## Unreleased ## Unreleased
### Added ### Added
- Ability to override serializer via custom route
### Changed ### Changed
@ -13,6 +12,13 @@
## Released ## Released
## [2.1.0] - February 18th, 2022
### Added
- Ability to override serializer via custom route
### Changed
- All complex types are now represented by reference schemas
- Deprecated `@Referenced` since all complex types now create references
## [2.0.4] - February 10th, 2022 ## [2.0.4] - February 10th, 2022
### Added ### Added
- Custom Type example to playground - Custom Type example to playground

View File

@ -1,5 +1,5 @@
# Kompendium # Kompendium
project.version=2.0.4 project.version=2.1.0
# Kotlin # Kotlin
kotlin.code.style=official kotlin.code.style=official
# Gradle # Gradle

View File

@ -6,6 +6,7 @@ package io.bkbn.kompendium.annotations
* If you do not annotate a recursive class with [Referenced], you will * If you do not annotate a recursive class with [Referenced], you will
* get a stack overflow error when you try to launch your API * get a stack overflow error when you try to launch your API
*/ */
@Deprecated("This annotation now does nothing, as all complex objects are stored as references")
@Retention(AnnotationRetention.RUNTIME) @Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
annotation class Referenced annotation class Referenced

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -82,7 +74,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": { "securitySchemes": {
"basic": { "basic": {
"type": "http", "type": "http",

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -82,7 +74,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": { "securitySchemes": {
"jwt": { "jwt": {
"bearerFormat": "JWT", "bearerFormat": "JWT",

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -82,7 +74,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": { "securitySchemes": {
"oauth": { "oauth": {
"flows": { "flows": {

View File

@ -20,7 +20,6 @@ class Kompendium(val config: Configuration) {
class Configuration { class Configuration {
lateinit var spec: OpenApiSpec lateinit var spec: OpenApiSpec
var cache: SchemaMap = mutableMapOf()
var openApiJson: Routing.(OpenApiSpec) -> Unit = { spec -> var openApiJson: Routing.(OpenApiSpec) -> Unit = { spec ->
route("/openapi.json") { route("/openapi.json") {
get { get {
@ -29,9 +28,12 @@ class Kompendium(val config: Configuration) {
} }
} }
var bodyCache: SchemaMap = mutableMapOf()
var parameterCache: SchemaMap = mutableMapOf()
// TODO Add tests for this!! // TODO Add tests for this!!
fun addCustomTypeSchema(clazz: KClass<*>, schema: TypedSchema) { fun addCustomTypeSchema(clazz: KClass<*>, schema: TypedSchema) {
cache[clazz.simpleName!!] = schema bodyCache[clazz.simpleName!!] = schema
} }
} }

View File

@ -1,16 +1,7 @@
package io.bkbn.kompendium.core package io.bkbn.kompendium.core
import io.bkbn.kompendium.core.util.Helpers.COMPONENT_SLUG
import io.bkbn.kompendium.oas.schema.AnyOfSchema
import io.bkbn.kompendium.oas.schema.ArraySchema
import io.bkbn.kompendium.oas.schema.ComponentSchema
import io.bkbn.kompendium.oas.schema.DictionarySchema
import io.bkbn.kompendium.oas.schema.EnumSchema import io.bkbn.kompendium.oas.schema.EnumSchema
import io.bkbn.kompendium.oas.schema.FormattedSchema
import io.bkbn.kompendium.oas.schema.FreeFormSchema
import io.bkbn.kompendium.oas.schema.ObjectSchema import io.bkbn.kompendium.oas.schema.ObjectSchema
import io.bkbn.kompendium.oas.schema.ReferencedSchema
import io.bkbn.kompendium.oas.schema.SimpleSchema
import io.ktor.application.feature import io.ktor.application.feature
import io.ktor.routing.Route import io.ktor.routing.Route
import io.ktor.routing.application import io.ktor.routing.application
@ -43,35 +34,17 @@ object KompendiumPreFlight {
} }
fun addToCache(paramType: KType, requestType: KType, responseType: KType, feature: Kompendium) { fun addToCache(paramType: KType, requestType: KType, responseType: KType, feature: Kompendium) {
Kontent.generateKontent(requestType, feature.config.cache) Kontent.generateKontent(requestType, feature.config.bodyCache)
Kontent.generateKontent(responseType, feature.config.cache) Kontent.generateKontent(responseType, feature.config.bodyCache)
Kontent.generateKontent(paramType, feature.config.cache) Kontent.generateKontent(paramType, feature.config.parameterCache)
feature.updateReferences() feature.generateReferences()
} }
private fun Kompendium.updateReferences() { fun Kompendium.generateReferences() {
val references = config.cache.values config.bodyCache
.asSequence() .filterValues { it is ObjectSchema || it is EnumSchema }
.map { flattenSchema(it) } .forEach { (k, v) ->
.flatten() config.spec.components.schemas[k] = v
.filterIsInstance<ReferencedSchema>()
.map { it.`$ref` }
.map { it.replace(COMPONENT_SLUG.plus("/"), "") }
.toList()
references.forEach { ref ->
config.spec.components.schemas[ref] = config.cache[ref] ?: error("$ref does not exist in cache 😱")
} }
} }
private fun flattenSchema(schema: ComponentSchema): List<ComponentSchema> = when (schema) {
is AnyOfSchema -> schema.anyOf.map { flattenSchema(it) }.flatten()
is ReferencedSchema -> listOf(schema)
is ArraySchema -> flattenSchema(schema.items)
is DictionarySchema -> flattenSchema(schema.additionalProperties)
is EnumSchema -> listOf(schema)
is FormattedSchema -> listOf(schema)
is FreeFormSchema -> listOf(schema)
is ObjectSchema -> schema.properties.values.map { flattenSchema(it) }.flatten()
is SimpleSchema -> listOf(schema)
}
} }

View File

@ -1,10 +1,10 @@
package io.bkbn.kompendium.core package io.bkbn.kompendium.core
import io.bkbn.kompendium.core.metadata.SchemaMap import io.bkbn.kompendium.core.metadata.SchemaMap
import io.bkbn.kompendium.core.schema.CollectionHandler import io.bkbn.kompendium.core.handler.CollectionHandler
import io.bkbn.kompendium.core.schema.EnumHandler import io.bkbn.kompendium.core.handler.EnumHandler
import io.bkbn.kompendium.core.schema.MapHandler import io.bkbn.kompendium.core.handler.MapHandler
import io.bkbn.kompendium.core.schema.ObjectHandler import io.bkbn.kompendium.core.handler.ObjectHandler
import io.bkbn.kompendium.core.util.Helpers.logged import io.bkbn.kompendium.core.util.Helpers.logged
import io.bkbn.kompendium.oas.schema.FormattedSchema import io.bkbn.kompendium.oas.schema.FormattedSchema
import io.bkbn.kompendium.oas.schema.SimpleSchema import io.bkbn.kompendium.oas.schema.SimpleSchema

View File

@ -102,10 +102,17 @@ fun SimpleSchema.scanForConstraints(prop: KProperty1<*, *>): SimpleSchema {
} }
fun ObjectSchema.scanForConstraints(clazz: KClass<*>, prop: KProperty1<*, *>): ObjectSchema { fun ObjectSchema.scanForConstraints(clazz: KClass<*>, prop: KProperty1<*, *>): ObjectSchema {
var schema = this.adjustForRequiredParams(clazz)
if (prop.returnType.isMarkedNullable) {
schema = schema.copy(nullable = true)
}
return schema
}
fun ObjectSchema.adjustForRequiredParams(clazz: KClass<*>): ObjectSchema {
val requiredParams = clazz.primaryConstructor?.parameters?.filterNot { it.isOptional } ?: emptyList() val requiredParams = clazz.primaryConstructor?.parameters?.filterNot { it.isOptional } ?: emptyList()
var schema = this var schema = this
// todo dedup this
if (requiredParams.isNotEmpty()) { if (requiredParams.isNotEmpty()) {
schema = schema.copy(required = requiredParams.map { param -> schema = schema.copy(required = requiredParams.map { param ->
clazz.memberProperties.first { it.name == param.name }.findAnnotation<Field>() clazz.memberProperties.first { it.name == param.name }.findAnnotation<Field>()
@ -113,10 +120,5 @@ fun ObjectSchema.scanForConstraints(clazz: KClass<*>, prop: KProperty1<*, *>): O
?: param.name!! ?: param.name!!
}) })
} }
if (prop.returnType.isMarkedNullable) {
schema = schema.copy(nullable = true)
}
return schema return schema
} }

View File

@ -1,4 +1,4 @@
package io.bkbn.kompendium.core.schema package io.bkbn.kompendium.core.handler
import io.bkbn.kompendium.core.Kontent import io.bkbn.kompendium.core.Kontent
import io.bkbn.kompendium.core.Kontent.generateKTypeKontent import io.bkbn.kompendium.core.Kontent.generateKTypeKontent
@ -33,10 +33,16 @@ object CollectionHandler : SchemaHandler {
val subTypes = gatherSubTypes(collectionType) val subTypes = gatherSubTypes(collectionType)
AnyOfSchema(subTypes.map { AnyOfSchema(subTypes.map {
generateKTypeKontent(it, cache) generateKTypeKontent(it, cache)
cache[it.getSimpleSlug()] ?: error("${it.getSimpleSlug()} not found") val schema = cache[it.getSimpleSlug()] ?: error("${it.getSimpleSlug()} not found")
val slug = it.getSimpleSlug()
postProcessSchema(schema, slug)
}) })
} }
false -> cache[collectionClass.simpleName] ?: error("${collectionClass.simpleName} not found") false -> {
val schema = cache[collectionClass.simpleName] ?: error("${collectionClass.simpleName} not found")
val slug = collectionClass.simpleName!!
postProcessSchema(schema, slug)
}
} }
val schema = ArraySchema(items = valueReference) val schema = ArraySchema(items = valueReference)
Kontent.generateKontent(collectionType, cache) Kontent.generateKontent(collectionType, cache)

View File

@ -1,4 +1,4 @@
package io.bkbn.kompendium.core.schema package io.bkbn.kompendium.core.handler
import io.bkbn.kompendium.core.metadata.SchemaMap import io.bkbn.kompendium.core.metadata.SchemaMap
import io.bkbn.kompendium.oas.schema.EnumSchema import io.bkbn.kompendium.oas.schema.EnumSchema

View File

@ -1,4 +1,4 @@
package io.bkbn.kompendium.core.schema package io.bkbn.kompendium.core.handler
import io.bkbn.kompendium.core.Kontent.generateKTypeKontent import io.bkbn.kompendium.core.Kontent.generateKTypeKontent
import io.bkbn.kompendium.core.Kontent.generateKontent import io.bkbn.kompendium.core.Kontent.generateKontent
@ -37,10 +37,15 @@ object MapHandler : SchemaHandler {
val subTypes = gatherSubTypes(valType) val subTypes = gatherSubTypes(valType)
AnyOfSchema(subTypes.map { AnyOfSchema(subTypes.map {
generateKTypeKontent(it, cache) generateKTypeKontent(it, cache)
cache[it.getSimpleSlug()] ?: error("${it.getSimpleSlug()} not found") val schema = cache[it.getSimpleSlug()] ?: error("${it.getSimpleSlug()} not found")
val slug = it.getSimpleSlug()
postProcessSchema(schema, slug)
}) })
} }
false -> cache[valClassName] ?: error("$valClassName not found") false -> {
val schema = cache[valClassName] ?: error("$valClassName not found")
postProcessSchema(schema, valClassName!!)
}
} }
val schema = DictionarySchema(additionalProperties = valueReference) val schema = DictionarySchema(additionalProperties = valueReference)
generateKontent(valType, cache) generateKontent(valType, cache)

View File

@ -1,13 +1,13 @@
package io.bkbn.kompendium.core.schema package io.bkbn.kompendium.core.handler
import io.bkbn.kompendium.annotations.Field import io.bkbn.kompendium.annotations.Field
import io.bkbn.kompendium.annotations.FreeFormObject import io.bkbn.kompendium.annotations.FreeFormObject
import io.bkbn.kompendium.annotations.Referenced
import io.bkbn.kompendium.annotations.UndeclaredField import io.bkbn.kompendium.annotations.UndeclaredField
import io.bkbn.kompendium.annotations.constraint.MaxProperties import io.bkbn.kompendium.annotations.constraint.MaxProperties
import io.bkbn.kompendium.annotations.constraint.MinProperties import io.bkbn.kompendium.annotations.constraint.MinProperties
import io.bkbn.kompendium.core.Kontent import io.bkbn.kompendium.core.Kontent
import io.bkbn.kompendium.core.Kontent.generateKontent import io.bkbn.kompendium.core.Kontent.generateKontent
import io.bkbn.kompendium.core.constraint.adjustForRequiredParams
import io.bkbn.kompendium.core.constraint.scanForConstraints import io.bkbn.kompendium.core.constraint.scanForConstraints
import io.bkbn.kompendium.core.metadata.SchemaMap import io.bkbn.kompendium.core.metadata.SchemaMap
import io.bkbn.kompendium.core.metadata.TypeMap import io.bkbn.kompendium.core.metadata.TypeMap
@ -24,9 +24,7 @@ import kotlin.reflect.KProperty1
import kotlin.reflect.KType import kotlin.reflect.KType
import kotlin.reflect.full.createType import kotlin.reflect.full.createType
import kotlin.reflect.full.findAnnotation import kotlin.reflect.full.findAnnotation
import kotlin.reflect.full.hasAnnotation
import kotlin.reflect.full.memberProperties import kotlin.reflect.full.memberProperties
import kotlin.reflect.full.primaryConstructor
import kotlin.reflect.jvm.javaField import kotlin.reflect.jvm.javaField
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
@ -46,67 +44,53 @@ object ObjectHandler : SchemaHandler {
// Only analyze if component has not already been stored in the cache // Only analyze if component has not already been stored in the cache
if (!cache.containsKey(slug)) { if (!cache.containsKey(slug)) {
logger.debug("$slug was not found in cache, generating now") logger.debug("$slug was not found in cache, generating now")
// TODO Replace with something better! // todo this should be some kind of empty schema at this point, then throw error if not updated eventually
// If referenced, add tie from simple slug to schema slug
if (clazz.hasAnnotation<Referenced>()) {
cache[type.getSimpleSlug()] = ReferencedSchema(type.getReferenceSlug()) cache[type.getSimpleSlug()] = ReferencedSchema(type.getReferenceSlug())
}
// Grabs any type parameters mapped to the corresponding type argument(s)
val typeMap: TypeMap = clazz.typeParameters.zip(type.arguments).toMap() val typeMap: TypeMap = clazz.typeParameters.zip(type.arguments).toMap()
// associates each member with a Pair of prop name to property schema val fieldMap = clazz.generateFieldMap(typeMap, cache)
val fieldMap = clazz.memberProperties.associate { prop -> .plus(clazz.generateUndeclaredFieldMap(cache))
logger.debug("Analyzing $prop in class $clazz") .mapValues { (_, fieldSchema) ->
val fieldSlug = cache.filter { (_, vv) -> vv == fieldSchema }.keys.firstOrNull()
// Grab the field of the current property postProcessSchema(fieldSchema, fieldSlug ?: "Fine if blank, will be ignored")
val field = prop.javaField?.type?.kotlin ?: error("Unable to parse field type from $prop")
// Short circuit if data is free form
val freeForm = prop.findAnnotation<FreeFormObject>()
var name = prop.name
when (freeForm) {
null -> {
val bleh = handleDefault(typeMap, prop, cache)
bleh.first
}
else -> handleFreeForm(prop)
}
}
logger.debug("Looking for undeclared fields")
val undeclaredFieldMap = clazz.annotations.filterIsInstance<UndeclaredField>().associate {
val undeclaredType = it.clazz.createType()
generateKontent(undeclaredType, cache)
it.field to cache[undeclaredType.getSimpleSlug()]!!
} }
logger.debug("$slug contains $fieldMap") logger.debug("$slug contains $fieldMap")
var schema = ObjectSchema(fieldMap.plus(undeclaredFieldMap)) val schema = ObjectSchema(fieldMap).adjustForRequiredParams(clazz)
val requiredParams = clazz.primaryConstructor?.parameters?.filterNot { it.isOptional } ?: emptyList()
// todo de-dup this logic
if (requiredParams.isNotEmpty()) {
schema = schema.copy(required = requiredParams.map { param ->
clazz.memberProperties.first { it.name == param.name }.findAnnotation<Field>()
?.let { field -> field.name.ifBlank { param.name!! } }
?: param.name!!
})
}
logger.debug("$slug schema: $schema") logger.debug("$slug schema: $schema")
cache[slug] = schema cache[slug] = schema
} }
} }
// TODO Better type, or just make map mutable /**
* Associates each member with a Pair of prop name to property schema
*/
private fun KClass<*>.generateFieldMap(typeMap: TypeMap, cache: SchemaMap) = memberProperties.associate { prop ->
logger.debug("Analyzing $prop in class $this")
// Short circuit if data is free form
when (prop.findAnnotation<FreeFormObject>()) {
null -> handleDefault(typeMap, prop, cache)
else -> handleFreeForm(prop)
}
}
private fun KClass<*>.generateUndeclaredFieldMap(cache: SchemaMap) =
annotations.filterIsInstance<UndeclaredField>().associate {
logger.debug("Identified undeclared field $it")
val undeclaredType = it.clazz.createType()
generateKontent(undeclaredType, cache)
it.field to cache[undeclaredType.getSimpleSlug()]!!
}
private fun handleDefault( private fun handleDefault(
typeMap: TypeMap, typeMap: TypeMap,
prop: KProperty1<*, *>, prop: KProperty1<*, *>,
cache: SchemaMap cache: SchemaMap
): Pair<Pair<String, ComponentSchema>, SchemaMap> { ): Pair<String, ComponentSchema> {
var name = prop.name
val field = prop.javaField?.type?.kotlin ?: error("Unable to parse field type from $prop") val field = prop.javaField?.type?.kotlin ?: error("Unable to parse field type from $prop")
val baseType = scanForGeneric(typeMap, prop) val baseType = scanForGeneric(typeMap, prop)
val baseClazz = baseType.classifier as KClass<*> val baseClazz = baseType.classifier as KClass<*>
val allTypes = scanForSealed(baseClazz, baseType) val allTypes = scanForSealed(baseClazz, baseType)
updateCache(cache, field, allTypes) updateCache(cache, field, allTypes)
var propSchema = constructComponentSchema( val propSchema = constructComponentSchema(
typeMap = typeMap, typeMap = typeMap,
prop = prop, prop = prop,
fieldClazz = field, fieldClazz = field,
@ -114,16 +98,20 @@ object ObjectHandler : SchemaHandler {
type = baseType, type = baseType,
cache = cache cache = cache
) )
// todo move to helper return propSchema.adjustForFieldOverrides(prop)
}
private fun ComponentSchema.adjustForFieldOverrides(prop: KProperty1<*, *>): Pair<String, ComponentSchema> {
var name = prop.name
prop.findAnnotation<Field>()?.let { fieldOverrides -> prop.findAnnotation<Field>()?.let { fieldOverrides ->
if (fieldOverrides.description.isNotBlank()) { if (fieldOverrides.description.isNotBlank()) {
propSchema = propSchema.setDescription(fieldOverrides.description) this.setDescription(fieldOverrides.description)
} }
if (fieldOverrides.name.isNotBlank()) { if (fieldOverrides.name.isNotBlank()) {
name = fieldOverrides.name name = fieldOverrides.name
} }
} }
return Pair(Pair(name, propSchema), cache) return Pair(name, this)
} }
private fun handleFreeForm(prop: KProperty1<*, *>): Pair<String, FreeFormSchema> { private fun handleFreeForm(prop: KProperty1<*, *>): Pair<String, FreeFormSchema> {

View File

@ -0,0 +1,32 @@
package io.bkbn.kompendium.core.handler
import io.bkbn.kompendium.core.metadata.SchemaMap
import io.bkbn.kompendium.core.util.Helpers.COMPONENT_SLUG
import io.bkbn.kompendium.oas.schema.ComponentSchema
import io.bkbn.kompendium.oas.schema.EnumSchema
import io.bkbn.kompendium.oas.schema.ObjectSchema
import io.bkbn.kompendium.oas.schema.ReferencedSchema
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.full.createType
interface SchemaHandler {
fun handle(type: KType, clazz: KClass<*>, cache: SchemaMap)
fun gatherSubTypes(type: KType): List<KType> {
val classifier = type.classifier as KClass<*>
return if (classifier.isSealed) {
classifier.sealedSubclasses.map {
it.createType(type.arguments)
}
} else {
listOf(type)
}
}
fun postProcessSchema(schema: ComponentSchema, slug: String): ComponentSchema = when (schema) {
is ObjectSchema -> ReferencedSchema(COMPONENT_SLUG.plus("/").plus(slug))
is EnumSchema -> ReferencedSchema(COMPONENT_SLUG.plus("/").plus(slug))
else -> schema
}
}

View File

@ -2,16 +2,19 @@ package io.bkbn.kompendium.core.parser
import io.bkbn.kompendium.annotations.Param import io.bkbn.kompendium.annotations.Param
import io.bkbn.kompendium.core.Kompendium import io.bkbn.kompendium.core.Kompendium
import io.bkbn.kompendium.core.KompendiumPreFlight.generateReferences
import io.bkbn.kompendium.core.Kontent import io.bkbn.kompendium.core.Kontent
import io.bkbn.kompendium.core.metadata.ExceptionInfo import io.bkbn.kompendium.core.metadata.ExceptionInfo
import io.bkbn.kompendium.core.metadata.ParameterExample import io.bkbn.kompendium.core.metadata.ParameterExample
import io.bkbn.kompendium.core.metadata.RequestInfo import io.bkbn.kompendium.core.metadata.RequestInfo
import io.bkbn.kompendium.core.metadata.ResponseInfo import io.bkbn.kompendium.core.metadata.ResponseInfo
import io.bkbn.kompendium.core.metadata.method.MethodInfo import io.bkbn.kompendium.core.metadata.method.MethodInfo
import io.bkbn.kompendium.core.metadata.method.PatchInfo
import io.bkbn.kompendium.core.metadata.method.PostInfo import io.bkbn.kompendium.core.metadata.method.PostInfo
import io.bkbn.kompendium.core.metadata.method.PutInfo import io.bkbn.kompendium.core.metadata.method.PutInfo
import io.bkbn.kompendium.core.util.Helpers import io.bkbn.kompendium.core.util.Helpers
import io.bkbn.kompendium.core.util.Helpers.capitalized import io.bkbn.kompendium.core.util.Helpers.capitalized
import io.bkbn.kompendium.core.util.Helpers.getReferenceSlug
import io.bkbn.kompendium.core.util.Helpers.getSimpleSlug import io.bkbn.kompendium.core.util.Helpers.getSimpleSlug
import io.bkbn.kompendium.oas.path.PathOperation import io.bkbn.kompendium.oas.path.PathOperation
import io.bkbn.kompendium.oas.payload.MediaType import io.bkbn.kompendium.oas.payload.MediaType
@ -20,6 +23,7 @@ import io.bkbn.kompendium.oas.payload.Request
import io.bkbn.kompendium.oas.payload.Response import io.bkbn.kompendium.oas.payload.Response
import io.bkbn.kompendium.oas.schema.AnyOfSchema import io.bkbn.kompendium.oas.schema.AnyOfSchema
import io.bkbn.kompendium.oas.schema.ObjectSchema import io.bkbn.kompendium.oas.schema.ObjectSchema
import io.bkbn.kompendium.oas.schema.ReferencedSchema
import io.ktor.routing.Route import io.ktor.routing.Route
import kotlin.reflect.KClass import kotlin.reflect.KClass
import kotlin.reflect.KParameter import kotlin.reflect.KParameter
@ -59,6 +63,7 @@ interface IMethodParser {
requestBody = when (info) { requestBody = when (info) {
is PutInfo<*, *, *> -> requestType.toRequestSpec(info.requestInfo, feature) is PutInfo<*, *, *> -> requestType.toRequestSpec(info.requestInfo, feature)
is PostInfo<*, *, *> -> requestType.toRequestSpec(info.requestInfo, feature) is PostInfo<*, *, *> -> requestType.toRequestSpec(info.requestInfo, feature)
is PatchInfo<*, *, *> -> requestType.toRequestSpec(info.requestInfo, feature)
else -> null else -> null
}, },
security = if (info.securitySchemes.isNotEmpty()) listOf( security = if (info.securitySchemes.isNotEmpty()) listOf(
@ -77,7 +82,8 @@ interface IMethodParser {
exceptionInfo: Set<ExceptionInfo<*>>, exceptionInfo: Set<ExceptionInfo<*>>,
feature: Kompendium, feature: Kompendium,
): Map<Int, Response> = exceptionInfo.associate { info -> ): Map<Int, Response> = exceptionInfo.associate { info ->
Kontent.generateKontent(info.responseType, feature.config.cache) Kontent.generateKontent(info.responseType, feature.config.bodyCache)
feature.generateReferences()
val response = Response( val response = Response(
description = info.description, description = info.description,
content = feature.resolveContent(info.responseType, info.mediaTypes, info.examples) content = feature.resolveContent(info.responseType, info.mediaTypes, info.examples)
@ -140,12 +146,14 @@ interface IMethodParser {
val schema = if (classifier.isSealed) { val schema = if (classifier.isSealed) {
val refs = classifier.sealedSubclasses val refs = classifier.sealedSubclasses
.map { it.createType(type.arguments) } .map { it.createType(type.arguments) }
.map { it.getSimpleSlug() } .map { ReferencedSchema(it.getReferenceSlug()) }
.map { config.cache[it] ?: error("$it not available") }
AnyOfSchema(refs) AnyOfSchema(refs)
} else { } else {
val ref = type.getSimpleSlug() if (config.spec.components.schemas.containsKey(type.getSimpleSlug())) {
config.cache[ref] ?: error("$ref not available") ReferencedSchema(type.getReferenceSlug())
} else {
config.bodyCache[type.getSimpleSlug()] ?: error("REEEE")
}
} }
MediaType( MediaType(
schema = schema, schema = schema,
@ -175,7 +183,7 @@ interface IMethodParser {
parentClazz: KClass<*>, parentClazz: KClass<*>,
feature: Kompendium feature: Kompendium
): Parameter { ): Parameter {
val wrapperSchema = feature.config.cache[parentType.getSimpleSlug()]!! as ObjectSchema val wrapperSchema = feature.config.parameterCache[parentType.getSimpleSlug()]!! as ObjectSchema
val anny = this.findAnnotation<Param>() val anny = this.findAnnotation<Param>()
?: error("Field $name is not annotated with KompendiumParam") ?: error("Field $name is not annotated with KompendiumParam")
val schema = wrapperSchema.properties[name] val schema = wrapperSchema.properties[name]

View File

@ -1,21 +0,0 @@
package io.bkbn.kompendium.core.schema
import io.bkbn.kompendium.core.metadata.SchemaMap
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.full.createType
interface SchemaHandler {
fun handle(type: KType, clazz: KClass<*>, cache: SchemaMap)
fun gatherSubTypes(type: KType): List<KType> {
val classifier = type.classifier as KClass<*>
return if (classifier.isSealed) {
classifier.sealedSubclasses.map {
it.createType(type.arguments)
}
} else {
listOf(type)
}
}
}

View File

@ -232,7 +232,7 @@ class KompendiumTest : DescribeSpec({
it("Can override field values via annotation") { it("Can override field values via annotation") {
openApiTestAllSerializers("field_override.json") { overrideFieldInfo() } openApiTestAllSerializers("field_override.json") { overrideFieldInfo() }
} }
it("Can serialize a recursive type using references") { it("Can serialize a recursive type") {
openApiTestAllSerializers("simple_recursive.json") { simpleRecursive() } openApiTestAllSerializers("simple_recursive.json") { simpleRecursive() }
} }
} }

View File

@ -37,6 +37,31 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/ComplexRequest"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "A Successful Endeavor",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TestCreatedResponse"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"ComplexRequest": {
"properties": { "properties": {
"amazing_field": { "amazing_field": {
"type": "string" "type": "string"
@ -46,23 +71,24 @@
}, },
"tables": { "tables": {
"items": { "items": {
"properties": { "$ref": "#/components/schemas/NestedComplexItem"
"alias": { },
"additionalProperties": { "type": "array"
"properties": {
"enumeration": {
"enum": [
"ONE",
"TWO"
],
"type": "string"
} }
}, },
"required": [ "required": [
"enumeration" "org",
"amazing_field",
"tables"
], ],
"type": "object" "type": "object"
}, },
"NestedComplexItem": {
"properties": {
"alias": {
"additionalProperties": {
"$ref": "#/components/schemas/CrazyItem"
},
"type": "object" "type": "object"
}, },
"name": { "name": {
@ -75,26 +101,25 @@
], ],
"type": "object" "type": "object"
}, },
"type": "array" "CrazyItem": {
"properties": {
"enumeration": {
"$ref": "#/components/schemas/SimpleEnum"
} }
}, },
"required": [ "required": [
"org", "enumeration"
"amazing_field",
"tables"
], ],
"type": "object" "type": "object"
}
}
}, },
"required": true "SimpleEnum": {
"enum": [
"ONE",
"TWO"
],
"type": "string"
}, },
"responses": { "TestCreatedResponse": {
"201": {
"description": "A Successful Endeavor",
"content": {
"application/json": {
"schema": {
"properties": { "properties": {
"c": { "c": {
"type": "string" "type": "string"
@ -110,16 +135,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -40,46 +40,10 @@
"schema": { "schema": {
"anyOf": [ "anyOf": [
{ {
"properties": { "$ref": "#/components/schemas/Gibbity-TestNested"
"a": {
"properties": {
"nesty": {
"type": "string"
}
},
"required": [
"nesty"
],
"type": "object"
}
},
"required": [
"a"
],
"type": "object"
}, },
{ {
"properties": { "$ref": "#/components/schemas/Bibbity-TestNested"
"b": {
"type": "string"
},
"f": {
"properties": {
"nesty": {
"type": "string"
}
},
"required": [
"nesty"
],
"type": "object"
}
},
"required": [
"b",
"f"
],
"type": "object"
} }
] ]
} }
@ -104,6 +68,61 @@
"schema": { "schema": {
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/Gibbity-FlibbityGibbit"
},
{
"$ref": "#/components/schemas/Bibbity-FlibbityGibbit"
}
]
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"Gibbity-TestNested": {
"properties": {
"a": {
"$ref": "#/components/schemas/TestNested"
}
},
"required": [
"a"
],
"type": "object"
},
"TestNested": {
"properties": {
"nesty": {
"type": "string"
}
},
"required": [
"nesty"
],
"type": "object"
},
"Bibbity-TestNested": {
"properties": {
"b": {
"type": "string"
},
"f": {
"$ref": "#/components/schemas/TestNested"
}
},
"required": [
"b",
"f"
],
"type": "object"
},
"Gibbity-FlibbityGibbit": {
"properties": { "properties": {
"a": { "a": {
"anyOf": [ "anyOf": [
@ -142,7 +161,34 @@
], ],
"type": "object" "type": "object"
}, },
{ "SimpleGibbit": {
"properties": {
"a": {
"type": "string"
}
},
"required": [
"a"
],
"type": "object"
},
"ComplexGibbit": {
"properties": {
"b": {
"type": "string"
},
"c": {
"format": "int32",
"type": "integer"
}
},
"required": [
"b",
"c"
],
"type": "object"
},
"Bibbity-FlibbityGibbit": {
"properties": { "properties": {
"b": { "b": {
"type": "string" "type": "string"
@ -185,18 +231,7 @@
], ],
"type": "object" "type": "object"
} }
]
}
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -37,6 +37,31 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/DefaultField"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "A successful endeavor",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TestResponse"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"DefaultField": {
"properties": { "properties": {
"a": { "a": {
"type": "string" "type": "string"
@ -50,17 +75,8 @@
"b" "b"
], ],
"type": "object" "type": "object"
}
}
}, },
"required": true "TestResponse": {
},
"responses": {
"200": {
"description": "A successful endeavor",
"content": {
"application/json": {
"schema": {
"properties": { "properties": {
"c": { "c": {
"type": "string" "type": "string"
@ -71,16 +87,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -49,15 +49,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -68,7 +60,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -71,15 +71,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -90,7 +82,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -37,36 +37,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestRequest"
"aaa": {
"items": {
"format": "int64",
"type": "integer"
},
"type": "array"
},
"b": {
"format": "double",
"type": "number"
},
"field_name": {
"properties": {
"nesty": {
"type": "string"
}
},
"required": [
"nesty"
],
"type": "object"
}
},
"required": [
"field_name",
"b",
"aaa"
],
"type": "object"
}, },
"examples": { "examples": {
"one": { "one": {
@ -100,15 +71,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}, },
"examples": { "examples": {
"test": { "test": {
@ -126,7 +89,54 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestRequest": {
"properties": {
"aaa": {
"items": {
"format": "int64",
"type": "integer"
},
"type": "array"
},
"b": {
"format": "double",
"type": "number"
},
"field_name": {
"$ref": "#/components/schemas/TestNested"
}
},
"required": [
"field_name",
"b",
"aaa"
],
"type": "object"
},
"TestNested": {
"properties": {
"nesty": {
"type": "string"
}
},
"required": [
"nesty"
],
"type": "object"
},
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/ExclusiveMinMax"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"ExclusiveMinMax": {
"properties": { "properties": {
"a": { "a": {
"format": "int32", "format": "int32",
@ -53,16 +66,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,16 +38,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestFieldOverride"
"real_name": {
"type": "boolean",
"description": "A Field that is super important!"
}
},
"required": [
"real_name"
],
"type": "object"
} }
} }
} }
@ -58,7 +49,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestFieldOverride": {
"properties": {
"real_name": {
"type": "boolean"
}
},
"required": [
"real_name"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -49,15 +49,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -68,7 +60,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/FreeFormData"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"FreeFormData": {
"properties": { "properties": {
"data": { "data": {
"additionalProperties": true, "additionalProperties": true,
@ -49,16 +62,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -78,6 +70,35 @@
"schema": { "schema": {
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/Gibbity-String"
},
{
"$ref": "#/components/schemas/Bibbity-String"
}
]
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
},
"Gibbity-String": {
"properties": { "properties": {
"a": { "a": {
"type": "string" "type": "string"
@ -88,7 +109,7 @@
], ],
"type": "object" "type": "object"
}, },
{ "Bibbity-String": {
"properties": { "properties": {
"b": { "b": {
"type": "string" "type": "string"
@ -103,18 +124,7 @@
], ],
"type": "object" "type": "object"
} }
]
}
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/TestGeneric-Int"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"TestGeneric-Int": {
"properties": { "properties": {
"messy": { "messy": {
"type": "string" "type": "string"
@ -53,16 +66,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MinMaxArray"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"MinMaxArray": {
"properties": { "properties": {
"a": { "a": {
"items": { "items": {
@ -53,16 +66,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MinMaxDouble"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"MinMaxDouble": {
"properties": { "properties": {
"a": { "a": {
"format": "double", "format": "double",
@ -53,16 +66,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MinMaxFreeForm"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"MinMaxFreeForm": {
"properties": { "properties": {
"data": { "data": {
"minProperties": 5, "minProperties": 5,
@ -51,16 +64,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MinMaxInt"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"MinMaxInt": {
"properties": { "properties": {
"a": { "a": {
"format": "int32", "format": "int32",
@ -53,16 +66,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MinMaxString"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"MinMaxString": {
"properties": { "properties": {
"a": { "a": {
"type": "string", "type": "string",
@ -50,16 +63,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MultipleOfDouble"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"MultipleOfDouble": {
"properties": { "properties": {
"a": { "a": {
"format": "double", "format": "double",
@ -50,16 +63,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/MultipleOfInt"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"MultipleOfInt": {
"properties": { "properties": {
"a": { "a": {
"format": "int32", "format": "int32",
@ -50,16 +63,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -77,7 +69,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -77,7 +69,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -76,15 +68,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/ExceptionResponse"
"message": {
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
} }
} }
} }
@ -95,7 +79,30 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
},
"ExceptionResponse": {
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -76,15 +68,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/ExceptionResponse"
"message": {
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
} }
} }
} }
@ -94,15 +78,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/ExceptionResponse"
"message": {
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
} }
} }
} }
@ -113,7 +89,30 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
},
"ExceptionResponse": {
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -59,15 +59,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -78,7 +70,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -77,7 +69,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -32,21 +32,24 @@
"summary": "Test patch endpoint", "summary": "Test patch endpoint",
"description": "patch your tests here!", "description": "patch your tests here!",
"parameters": [], "parameters": [],
"requestBody": {
"description": "A Test request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TestRequest"
}
}
},
"required": true
},
"responses": { "responses": {
"201": { "201": {
"description": "A Successful Endeavor", "description": "A Successful Endeavor",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -57,7 +60,54 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestRequest": {
"properties": {
"aaa": {
"items": {
"format": "int64",
"type": "integer"
},
"type": "array"
},
"b": {
"format": "double",
"type": "number"
},
"field_name": {
"$ref": "#/components/schemas/TestNested"
}
},
"required": [
"field_name",
"b",
"aaa"
],
"type": "object"
},
"TestNested": {
"properties": {
"nesty": {
"type": "string"
}
},
"required": [
"nesty"
],
"type": "object"
},
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -57,6 +57,31 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/TestRequest"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "A Successful Endeavor",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TestCreatedResponse"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"TestRequest": {
"properties": { "properties": {
"aaa": { "aaa": {
"items": { "items": {
@ -70,6 +95,17 @@
"type": "number" "type": "number"
}, },
"field_name": { "field_name": {
"$ref": "#/components/schemas/TestNested"
}
},
"required": [
"field_name",
"b",
"aaa"
],
"type": "object"
},
"TestNested": {
"properties": { "properties": {
"nesty": { "nesty": {
"type": "string" "type": "string"
@ -79,25 +115,8 @@
"nesty" "nesty"
], ],
"type": "object" "type": "object"
}
}, },
"required": [ "TestCreatedResponse": {
"field_name",
"b",
"aaa"
],
"type": "object"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "A Successful Endeavor",
"content": {
"application/json": {
"schema": {
"properties": { "properties": {
"c": { "c": {
"type": "string" "type": "string"
@ -113,16 +132,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -57,6 +57,31 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/TestRequest"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "A Successful Endeavor",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TestCreatedResponse"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"TestRequest": {
"properties": { "properties": {
"aaa": { "aaa": {
"items": { "items": {
@ -70,6 +95,17 @@
"type": "number" "type": "number"
}, },
"field_name": { "field_name": {
"$ref": "#/components/schemas/TestNested"
}
},
"required": [
"field_name",
"b",
"aaa"
],
"type": "object"
},
"TestNested": {
"properties": { "properties": {
"nesty": { "nesty": {
"type": "string" "type": "string"
@ -79,25 +115,8 @@
"nesty" "nesty"
], ],
"type": "object" "type": "object"
}
}, },
"required": [ "TestCreatedResponse": {
"field_name",
"b",
"aaa"
],
"type": "object"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "A Successful Endeavor",
"content": {
"application/json": {
"schema": {
"properties": { "properties": {
"c": { "c": {
"type": "string" "type": "string"
@ -113,16 +132,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -37,16 +37,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/NullableField"
"a": {
"type": "string",
"nullable": true
}
},
"required": [
"a"
],
"type": "object"
} }
} }
}, },
@ -58,15 +49,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -77,7 +60,31 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"NullableField": {
"properties": {
"a": {
"type": "string",
"nullable": true
}
},
"required": [
"a"
],
"type": "object"
},
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -48,15 +48,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -67,7 +59,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -77,7 +69,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -78,6 +70,35 @@
"schema": { "schema": {
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/SimpleGibbit"
},
{
"$ref": "#/components/schemas/ComplexGibbit"
}
]
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
},
"SimpleGibbit": {
"properties": { "properties": {
"a": { "a": {
"type": "string" "type": "string"
@ -88,7 +109,7 @@
], ],
"type": "object" "type": "object"
}, },
{ "ComplexGibbit": {
"properties": { "properties": {
"b": { "b": {
"type": "string" "type": "string"
@ -104,18 +125,7 @@
], ],
"type": "object" "type": "object"
} }
]
}
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -41,6 +41,30 @@
"items": { "items": {
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/SimpleGibbit"
},
{
"$ref": "#/components/schemas/ComplexGibbit"
}
]
},
"type": "array"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"FlibbityGibbit": {
"properties": {},
"type": "object"
},
"SimpleGibbit": {
"properties": { "properties": {
"a": { "a": {
"type": "string" "type": "string"
@ -51,7 +75,7 @@
], ],
"type": "object" "type": "object"
}, },
{ "ComplexGibbit": {
"properties": { "properties": {
"b": { "b": {
"type": "string" "type": "string"
@ -67,20 +91,7 @@
], ],
"type": "object" "type": "object"
} }
]
}, },
"type": "array"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -41,6 +41,30 @@
"additionalProperties": { "additionalProperties": {
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/SimpleGibbit"
},
{
"$ref": "#/components/schemas/ComplexGibbit"
}
]
},
"type": "object"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"FlibbityGibbit": {
"properties": {},
"type": "object"
},
"SimpleGibbit": {
"properties": { "properties": {
"a": { "a": {
"type": "string" "type": "string"
@ -51,7 +75,7 @@
], ],
"type": "object" "type": "object"
}, },
{ "ComplexGibbit": {
"properties": { "properties": {
"b": { "b": {
"type": "string" "type": "string"
@ -67,20 +91,7 @@
], ],
"type": "object" "type": "object"
} }
]
}, },
"type": "object"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -40,6 +40,24 @@
"schema": { "schema": {
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/SimpleGibbit"
},
{
"$ref": "#/components/schemas/ComplexGibbit"
}
]
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"SimpleGibbit": {
"properties": { "properties": {
"a": { "a": {
"type": "string" "type": "string"
@ -50,7 +68,7 @@
], ],
"type": "object" "type": "object"
}, },
{ "ComplexGibbit": {
"properties": { "properties": {
"b": { "b": {
"type": "string" "type": "string"
@ -66,18 +84,7 @@
], ],
"type": "object" "type": "object"
} }
]
}
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -40,46 +40,10 @@
"schema": { "schema": {
"anyOf": [ "anyOf": [
{ {
"properties": { "$ref": "#/components/schemas/Gibbity-TestNested"
"a": {
"properties": {
"nesty": {
"type": "string"
}
},
"required": [
"nesty"
],
"type": "object"
}
},
"required": [
"a"
],
"type": "object"
}, },
{ {
"properties": { "$ref": "#/components/schemas/Bibbity-TestNested"
"b": {
"type": "string"
},
"f": {
"properties": {
"nesty": {
"type": "string"
}
},
"required": [
"nesty"
],
"type": "object"
}
},
"required": [
"b",
"f"
],
"type": "object"
} }
] ]
} }
@ -92,7 +56,45 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"Gibbity-TestNested": {
"properties": {
"a": {
"$ref": "#/components/schemas/TestNested"
}
},
"required": [
"a"
],
"type": "object"
},
"TestNested": {
"properties": {
"nesty": {
"type": "string"
}
},
"required": [
"nesty"
],
"type": "object"
},
"Bibbity-TestNested": {
"properties": {
"b": {
"type": "string"
},
"f": {
"$ref": "#/components/schemas/TestNested"
}
},
"required": [
"b",
"f"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -69,15 +69,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -88,7 +80,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/RegexString"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"RegexString": {
"properties": { "properties": {
"a": { "a": {
"type": "string", "type": "string",
@ -49,16 +62,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -48,15 +48,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -67,7 +59,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -59,15 +59,7 @@
"application/json": { "application/json": {
"schema": { "schema": {
"items": { "items": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}, },
"type": "array" "type": "array"
} }
@ -80,7 +72,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -77,7 +69,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -40,70 +40,16 @@
"schema": { "schema": {
"anyOf": [ "anyOf": [
{ {
"properties": { "$ref": "#/components/schemas/OneJamma"
"a": {
"format": "int32",
"type": "integer"
}
},
"required": [
"a"
],
"type": "object"
}, },
{ {
"properties": { "$ref": "#/components/schemas/AnothaJamma"
"b": {
"format": "float",
"type": "number"
}
},
"required": [
"b"
],
"type": "object"
},
{
"properties": {
"c": {
"anyOf": [
{
"properties": {
"a": {
"format": "int32",
"type": "integer"
}
},
"required": [
"a"
],
"type": "object"
},
{
"properties": {
"b": {
"format": "float",
"type": "number"
}
},
"required": [
"b"
],
"type": "object"
}, },
{ {
"$ref": "#/components/schemas/InsaneJamma" "$ref": "#/components/schemas/InsaneJamma"
} }
] ]
} }
},
"required": [
"c"
],
"type": "object"
}
]
}
} }
} }
} }
@ -114,6 +60,30 @@
}, },
"components": { "components": {
"schemas": { "schemas": {
"OneJamma": {
"properties": {
"a": {
"format": "int32",
"type": "integer"
}
},
"required": [
"a"
],
"type": "object"
},
"AnothaJamma": {
"properties": {
"b": {
"format": "float",
"type": "number"
}
},
"required": [
"b"
],
"type": "object"
},
"InsaneJamma": { "InsaneJamma": {
"properties": { "properties": {
"c": { "c": {

View File

@ -38,38 +38,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": {
"description": {
"type": "string"
},
"mode": {
"enum": [
"NULLABLE",
"REQUIRED",
"REPEATED"
],
"type": "string"
},
"name": {
"type": "string"
},
"subColumns": {
"items": {
"$ref": "#/components/schemas/ColumnSchema" "$ref": "#/components/schemas/ColumnSchema"
},
"type": "array"
},
"type": {
"type": "string"
}
},
"required": [
"name",
"type",
"description",
"mode"
],
"type": "object"
} }
} }
} }
@ -87,12 +56,7 @@
"type": "string" "type": "string"
}, },
"mode": { "mode": {
"enum": [ "$ref": "#/components/schemas/ColumnMode"
"NULLABLE",
"REQUIRED",
"REPEATED"
],
"type": "string"
}, },
"name": { "name": {
"type": "string" "type": "string"
@ -114,6 +78,14 @@
"mode" "mode"
], ],
"type": "object" "type": "object"
},
"ColumnMode": {
"enum": [
"NULLABLE",
"REQUIRED",
"REPEATED"
],
"type": "string"
} }
}, },
"securitySchemes": {} "securitySchemes": {}

View File

@ -58,15 +58,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/TestResponse"
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
} }
} }
} }
@ -77,7 +69,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"TestResponse": {
"properties": {
"c": {
"type": "string"
}
},
"required": [
"c"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,22 +38,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/Mysterious"
"nowYouSeeMe": {
"type": "string"
},
"nowYouDont": {
"enum": [
"HAHA",
"HOHO"
],
"type": "string"
}
},
"required": [
"nowYouSeeMe"
],
"type": "object"
} }
} }
} }
@ -64,7 +49,29 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"Mysterious": {
"properties": {
"nowYouSeeMe": {
"type": "string"
},
"nowYouDont": {
"$ref": "#/components/schemas/Hehe"
}
},
"required": [
"nowYouSeeMe"
],
"type": "object"
},
"Hehe": {
"enum": [
"HAHA",
"HOHO"
],
"type": "string"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -38,6 +38,19 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/UniqueArray"
}
}
}
}
},
"deprecated": false
}
}
},
"components": {
"schemas": {
"UniqueArray": {
"properties": { "properties": {
"a": { "a": {
"items": { "items": {
@ -53,16 +66,7 @@
], ],
"type": "object" "type": "object"
} }
}
}
}
}, },
"deprecated": false
}
}
},
"components": {
"schemas": {},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -4,7 +4,6 @@ import io.bkbn.kompendium.annotations.Field
import io.bkbn.kompendium.annotations.FreeFormObject import io.bkbn.kompendium.annotations.FreeFormObject
import io.bkbn.kompendium.annotations.Param import io.bkbn.kompendium.annotations.Param
import io.bkbn.kompendium.annotations.ParamType import io.bkbn.kompendium.annotations.ParamType
import io.bkbn.kompendium.annotations.Referenced
import io.bkbn.kompendium.annotations.UndeclaredField import io.bkbn.kompendium.annotations.UndeclaredField
import io.bkbn.kompendium.annotations.constraint.Format import io.bkbn.kompendium.annotations.constraint.Format
import io.bkbn.kompendium.annotations.constraint.MaxItems import io.bkbn.kompendium.annotations.constraint.MaxItems
@ -204,7 +203,6 @@ sealed interface SlammaJamma
data class OneJamma(val a: Int) : SlammaJamma data class OneJamma(val a: Int) : SlammaJamma
data class AnothaJamma(val b: Float) : SlammaJamma data class AnothaJamma(val b: Float) : SlammaJamma
@Referenced
data class InsaneJamma(val c: SlammaJamma) : SlammaJamma data class InsaneJamma(val c: SlammaJamma) : SlammaJamma
sealed interface Flibbity<T> sealed interface Flibbity<T>
@ -230,7 +228,6 @@ enum class ColumnMode {
REPEATED REPEATED
} }
@Referenced
data class ColumnSchema( data class ColumnSchema(
val name: String, val name: String,
val type: String, val type: String,

View File

@ -57,15 +57,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleResponse"
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
} }
} }
} }
@ -76,7 +68,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"SimpleResponse": {
"properties": {
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -48,15 +48,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleResponse"
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
} }
} }
} }
@ -67,7 +59,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"SimpleResponse": {
"properties": {
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -57,15 +57,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleResponse"
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
} }
} }
} }
@ -76,7 +68,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"SimpleResponse": {
"properties": {
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -48,15 +48,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleResponse"
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
} }
} }
} }
@ -67,7 +59,19 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"SimpleResponse": {
"properties": {
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -56,15 +56,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleRequest"
"input": {
"type": "string"
}
},
"required": [
"input"
],
"type": "object"
} }
} }
}, },
@ -76,15 +68,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleResponse"
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
} }
} }
} }
@ -95,7 +79,30 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"SimpleRequest": {
"properties": {
"input": {
"type": "string"
}
},
"required": [
"input"
],
"type": "object"
},
"SimpleResponse": {
"properties": {
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -47,15 +47,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleRequest"
"input": {
"type": "string"
}
},
"required": [
"input"
],
"type": "object"
} }
} }
}, },
@ -67,15 +59,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleResponse"
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
} }
} }
} }
@ -86,7 +70,30 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"SimpleRequest": {
"properties": {
"input": {
"type": "string"
}
},
"required": [
"input"
],
"type": "object"
},
"SimpleResponse": {
"properties": {
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -56,15 +56,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleRequest"
"input": {
"type": "string"
}
},
"required": [
"input"
],
"type": "object"
} }
} }
}, },
@ -76,15 +68,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleResponse"
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
} }
} }
} }
@ -95,7 +79,30 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"SimpleRequest": {
"properties": {
"input": {
"type": "string"
}
},
"required": [
"input"
],
"type": "object"
},
"SimpleResponse": {
"properties": {
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],

View File

@ -47,15 +47,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleRequest"
"input": {
"type": "string"
}
},
"required": [
"input"
],
"type": "object"
} }
} }
}, },
@ -67,15 +59,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "$ref": "#/components/schemas/SimpleResponse"
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
} }
} }
} }
@ -86,7 +70,30 @@
} }
}, },
"components": { "components": {
"schemas": {}, "schemas": {
"SimpleRequest": {
"properties": {
"input": {
"type": "string"
}
},
"required": [
"input"
],
"type": "object"
},
"SimpleResponse": {
"properties": {
"result": {
"type": "boolean"
}
},
"required": [
"result"
],
"type": "object"
}
},
"securitySchemes": {} "securitySchemes": {}
}, },
"security": [], "security": [],