chore: prep for 3.3.0 (#319)
This commit is contained in:
17
CHANGELOG.md
17
CHANGELOG.md
@ -2,10 +2,6 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Support for @Transient annotation
|
||||
- Support for @SerialName annotation on fields
|
||||
- Supports for un-backed fields, by excluding them from the generated schema.
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
@ -16,6 +12,19 @@
|
||||
|
||||
## Released
|
||||
|
||||
## [3.3.0] - September 15th, 2022
|
||||
|
||||
### Added
|
||||
- Support for @Transient annotation
|
||||
- Support for @SerialName annotation on fields
|
||||
- Supports for un-backed fields, by excluding them from the generated schema.
|
||||
|
||||
### Changed
|
||||
- Actually turned on detekt formatting 🤦
|
||||
- Removed some rouge print statements
|
||||
|
||||
## Released
|
||||
|
||||
## [3.2.0] - August 23rd, 2022
|
||||
|
||||
### Added
|
||||
|
@ -22,6 +22,7 @@ dependencies {
|
||||
// VERSIONS
|
||||
val kotestVersion: String by project
|
||||
val ktorVersion: String by project
|
||||
val detektVersion: String by project
|
||||
|
||||
// IMPLEMENTATION
|
||||
|
||||
@ -35,6 +36,9 @@ dependencies {
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
|
||||
implementation("ch.qos.logback:logback-classic:1.4.1")
|
||||
|
||||
// Formatting
|
||||
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
|
||||
|
||||
// TEST FIXTURES
|
||||
|
||||
testFixturesApi("io.kotest:kotest-runner-junit5-jvm:$kotestVersion")
|
||||
|
@ -36,5 +36,4 @@ class DeleteInfo private constructor(
|
||||
parameters = parameters
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,5 +36,4 @@ class GetInfo private constructor(
|
||||
parameters = parameters
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,5 +36,4 @@ class HeadInfo private constructor(
|
||||
parameters = parameters
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,5 +36,4 @@ class OptionsInfo private constructor(
|
||||
parameters = parameters
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,5 +38,4 @@ class PatchInfo private constructor(
|
||||
parameters = parameters
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,5 +38,4 @@ class PostInfo private constructor(
|
||||
parameters = parameters
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,5 +38,4 @@ class PutInfo private constructor(
|
||||
parameters = parameters
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,5 +41,4 @@ class RequestInfo private constructor(
|
||||
examples = examples
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ fun Route.redoc(pageTitle: String = "Docs", specUrl: String = "/openapi.json") {
|
||||
}
|
||||
}
|
||||
body {
|
||||
unsafe { +"<redoc spec-url='${specUrl}'></redoc>" }
|
||||
unsafe { +"<redoc spec-url='$specUrl'></redoc>" }
|
||||
script {
|
||||
src = "https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ import io.bkbn.kompendium.core.metadata.PatchInfo
|
||||
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||
import io.bkbn.kompendium.core.metadata.ResponseInfo
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.definition.ReferenceDefinition
|
||||
import io.bkbn.kompendium.json.schema.util.Helpers.getReferenceSlug
|
||||
import io.bkbn.kompendium.json.schema.util.Helpers.getSimpleSlug
|
||||
|
@ -10,11 +10,6 @@ import io.bkbn.kompendium.core.util.TestModules.defaultAuthConfig
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultField
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultParameter
|
||||
import io.bkbn.kompendium.core.util.TestModules.exampleParams
|
||||
import io.bkbn.kompendium.core.util.TestModules.nestedUnderRoot
|
||||
import io.bkbn.kompendium.core.util.TestModules.nonRequiredParams
|
||||
import io.bkbn.kompendium.core.util.TestModules.notarizedDelete
|
||||
import io.bkbn.kompendium.core.util.TestModules.notarizedGet
|
||||
import io.bkbn.kompendium.core.util.TestModules.singleException
|
||||
import io.bkbn.kompendium.core.util.TestModules.genericException
|
||||
import io.bkbn.kompendium.core.util.TestModules.genericPolymorphicResponse
|
||||
import io.bkbn.kompendium.core.util.TestModules.genericPolymorphicResponseMultipleImpls
|
||||
@ -27,8 +22,11 @@ import io.bkbn.kompendium.core.util.TestModules.nestedGenericCollection
|
||||
import io.bkbn.kompendium.core.util.TestModules.nestedGenericMultipleParamsCollection
|
||||
import io.bkbn.kompendium.core.util.TestModules.nestedGenericResponse
|
||||
import io.bkbn.kompendium.core.util.TestModules.nestedTypeName
|
||||
import io.bkbn.kompendium.core.util.TestModules.nestedUnderRoot
|
||||
import io.bkbn.kompendium.core.util.TestModules.nonRequiredParam
|
||||
import io.bkbn.kompendium.core.util.TestModules.polymorphicException
|
||||
import io.bkbn.kompendium.core.util.TestModules.nonRequiredParams
|
||||
import io.bkbn.kompendium.core.util.TestModules.notarizedDelete
|
||||
import io.bkbn.kompendium.core.util.TestModules.notarizedGet
|
||||
import io.bkbn.kompendium.core.util.TestModules.notarizedHead
|
||||
import io.bkbn.kompendium.core.util.TestModules.notarizedOptions
|
||||
import io.bkbn.kompendium.core.util.TestModules.notarizedPatch
|
||||
@ -39,6 +37,7 @@ import io.bkbn.kompendium.core.util.TestModules.nullableField
|
||||
import io.bkbn.kompendium.core.util.TestModules.nullableNestedObject
|
||||
import io.bkbn.kompendium.core.util.TestModules.nullableReference
|
||||
import io.bkbn.kompendium.core.util.TestModules.polymorphicCollectionResponse
|
||||
import io.bkbn.kompendium.core.util.TestModules.polymorphicException
|
||||
import io.bkbn.kompendium.core.util.TestModules.polymorphicMapResponse
|
||||
import io.bkbn.kompendium.core.util.TestModules.polymorphicResponse
|
||||
import io.bkbn.kompendium.core.util.TestModules.primitives
|
||||
@ -49,6 +48,7 @@ import io.bkbn.kompendium.core.util.TestModules.rootRoute
|
||||
import io.bkbn.kompendium.core.util.TestModules.simpleGenericResponse
|
||||
import io.bkbn.kompendium.core.util.TestModules.simplePathParsing
|
||||
import io.bkbn.kompendium.core.util.TestModules.simpleRecursive
|
||||
import io.bkbn.kompendium.core.util.TestModules.singleException
|
||||
import io.bkbn.kompendium.core.util.TestModules.trailingSlash
|
||||
import io.bkbn.kompendium.core.util.TestModules.unbackedFieldsResponse
|
||||
import io.bkbn.kompendium.core.util.TestModules.withOperationId
|
||||
@ -189,7 +189,9 @@ class KompendiumTest : DescribeSpec({
|
||||
openApiTestAllSerializers("T0039__nested_generic_collection.json") { nestedGenericCollection() }
|
||||
}
|
||||
it("Can support nested generics with multiple type parameters") {
|
||||
openApiTestAllSerializers("T0040__nested_generic_multiple_type_params.json") { nestedGenericMultipleParamsCollection() }
|
||||
openApiTestAllSerializers("T0040__nested_generic_multiple_type_params.json") {
|
||||
nestedGenericMultipleParamsCollection()
|
||||
}
|
||||
}
|
||||
it("Can handle a really gnarly generic example") {
|
||||
openApiTestAllSerializers("T0043__gnarly_generic_example.json") { gnarlyGenericResponse() }
|
||||
|
@ -1,6 +1,30 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.*
|
||||
import io.bkbn.kompendium.core.fixtures.Barzo
|
||||
import io.bkbn.kompendium.core.fixtures.ColumnSchema
|
||||
import io.bkbn.kompendium.core.fixtures.ComplexRequest
|
||||
import io.bkbn.kompendium.core.fixtures.DateTimeString
|
||||
import io.bkbn.kompendium.core.fixtures.DefaultField
|
||||
import io.bkbn.kompendium.core.fixtures.ExceptionResponse
|
||||
import io.bkbn.kompendium.core.fixtures.Flibbity
|
||||
import io.bkbn.kompendium.core.fixtures.FlibbityGibbit
|
||||
import io.bkbn.kompendium.core.fixtures.Foosy
|
||||
import io.bkbn.kompendium.core.fixtures.Gibbity
|
||||
import io.bkbn.kompendium.core.fixtures.ManyThings
|
||||
import io.bkbn.kompendium.core.fixtures.MultiNestedGenerics
|
||||
import io.bkbn.kompendium.core.fixtures.Nested
|
||||
import io.bkbn.kompendium.core.fixtures.NullableEnum
|
||||
import io.bkbn.kompendium.core.fixtures.NullableField
|
||||
import io.bkbn.kompendium.core.fixtures.Page
|
||||
import io.bkbn.kompendium.core.fixtures.ProfileUpdateRequest
|
||||
import io.bkbn.kompendium.core.fixtures.SerialNameObject
|
||||
import io.bkbn.kompendium.core.fixtures.TestCreatedResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestNested
|
||||
import io.bkbn.kompendium.core.fixtures.TestRequest
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestSimpleRequest
|
||||
import io.bkbn.kompendium.core.fixtures.TransientObject
|
||||
import io.bkbn.kompendium.core.fixtures.UnbakcedObject
|
||||
import io.bkbn.kompendium.core.metadata.DeleteInfo
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.metadata.HeadInfo
|
||||
|
@ -15,6 +15,13 @@ style:
|
||||
excludeCommentStatements: true
|
||||
MagicNumber:
|
||||
excludes: ['**/kompendium-playground/**/*', '**/test/**/*']
|
||||
ForbiddenMethodCall:
|
||||
active: true
|
||||
formatting:
|
||||
Indentation:
|
||||
indentSize: 2
|
||||
ImportOrdering:
|
||||
active: false
|
||||
naming:
|
||||
ConstructorParameterNaming:
|
||||
active: false
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Kompendium
|
||||
project.version=3.2.0
|
||||
project.version=3.3.0
|
||||
# Kotlin
|
||||
kotlin.code.style=official
|
||||
# Gradle
|
||||
@ -10,3 +10,4 @@ org.gradle.jvmargs=-Xmx2000m
|
||||
# Dependencies
|
||||
ktorVersion=2.1.1
|
||||
kotestVersion=5.4.2
|
||||
detektVersion=1.21.0
|
||||
|
@ -18,9 +18,15 @@ sourdoughLibrary {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Versions
|
||||
val detektVersion: String by project
|
||||
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.7.10")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
|
||||
|
||||
// Formatting
|
||||
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
|
||||
|
||||
testImplementation(testFixtures(projects.kompendiumCore))
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,9 @@ interface SchemaConfigurator {
|
||||
fun serializableName(property: KProperty1<out Any, *>): String
|
||||
|
||||
open class Default : SchemaConfigurator {
|
||||
override fun serializableMemberProperties(clazz: KClass<*>): Collection<KProperty1<out Any, *>>
|
||||
= clazz.memberProperties
|
||||
override fun serializableName(property: KProperty1<out Any, *>): String
|
||||
= property.name
|
||||
}
|
||||
override fun serializableMemberProperties(clazz: KClass<*>): Collection<KProperty1<out Any, *>> =
|
||||
clazz.memberProperties
|
||||
|
||||
override fun serializableName(property: KProperty1<out Any, *>): String = property.name
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||
import io.bkbn.kompendium.json.schema.handler.CollectionHandler
|
||||
import io.bkbn.kompendium.json.schema.handler.EnumHandler
|
||||
import io.bkbn.kompendium.json.schema.handler.MapHandler
|
||||
import io.bkbn.kompendium.json.schema.handler.SimpleObjectHandler
|
||||
import io.bkbn.kompendium.json.schema.handler.SealedObjectHandler
|
||||
import io.bkbn.kompendium.json.schema.handler.SimpleObjectHandler
|
||||
import io.bkbn.kompendium.json.schema.util.Helpers.getSimpleSlug
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KType
|
||||
@ -39,6 +39,7 @@ object SchemaGenerator {
|
||||
please call SchemaGenerator.fromTypeOrUnit()
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
Int::class -> checkForNull(type, TypeDefinition.INT)
|
||||
Long::class -> checkForNull(type, TypeDefinition.LONG)
|
||||
Double::class -> checkForNull(type, TypeDefinition.DOUBLE)
|
||||
@ -71,7 +72,7 @@ object SchemaGenerator {
|
||||
else -> fromTypeToSchema(type, cache, schemaConfigurator)
|
||||
}
|
||||
|
||||
private fun checkForNull(type: KType, schema: JsonSchema, ): JsonSchema = when (type.isMarkedNullable) {
|
||||
private fun checkForNull(type: KType, schema: JsonSchema): JsonSchema = when (type.isMarkedNullable) {
|
||||
true -> OneOfDefinition(NullableDefinition(), schema)
|
||||
false -> schema
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.bkbn.kompendium.json.schema.handler
|
||||
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.definition.ArrayDefinition
|
||||
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
||||
import io.bkbn.kompendium.json.schema.definition.NullableDefinition
|
||||
@ -13,7 +13,6 @@ import io.bkbn.kompendium.json.schema.util.Helpers.getSimpleSlug
|
||||
import kotlin.reflect.KType
|
||||
|
||||
object CollectionHandler {
|
||||
|
||||
fun handle(type: KType, cache: MutableMap<String, JsonSchema>, schemaConfigurator: SchemaConfigurator): JsonSchema {
|
||||
val collectionType = type.arguments.first().type
|
||||
?: error("This indicates a bug in Kompendium, please open a GitHub issue!")
|
||||
@ -31,5 +30,4 @@ object CollectionHandler {
|
||||
false -> definition
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KType
|
||||
|
||||
object EnumHandler {
|
||||
|
||||
fun handle(type: KType, clazz: KClass<*>): JsonSchema {
|
||||
val options = clazz.java.enumConstants.map { it.toString() }.toSet()
|
||||
val definition = EnumDefinition(enum = options)
|
||||
@ -17,5 +16,4 @@ object EnumHandler {
|
||||
false -> definition
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.bkbn.kompendium.json.schema.handler
|
||||
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
||||
import io.bkbn.kompendium.json.schema.definition.MapDefinition
|
||||
import io.bkbn.kompendium.json.schema.definition.NullableDefinition
|
||||
@ -34,5 +34,4 @@ object MapHandler {
|
||||
false -> definition
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.bkbn.kompendium.json.schema.handler
|
||||
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.definition.AnyOfDefinition
|
||||
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
||||
import io.bkbn.kompendium.json.schema.definition.ReferenceDefinition
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.bkbn.kompendium.json.schema.handler
|
||||
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
||||
import io.bkbn.kompendium.json.schema.definition.NullableDefinition
|
||||
import io.bkbn.kompendium.json.schema.definition.OneOfDefinition
|
||||
|
@ -1,7 +1,15 @@
|
||||
package io.bkbn.kompendium.json.schema
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.*
|
||||
import io.bkbn.kompendium.core.fixtures.ComplexRequest
|
||||
import io.bkbn.kompendium.core.fixtures.FlibbityGibbit
|
||||
import io.bkbn.kompendium.core.fixtures.SerialNameObject
|
||||
import io.bkbn.kompendium.core.fixtures.SimpleEnum
|
||||
import io.bkbn.kompendium.core.fixtures.SlammaJamma
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers.getFileSnapshot
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestSimpleRequest
|
||||
import io.bkbn.kompendium.core.fixtures.TransientObject
|
||||
import io.bkbn.kompendium.core.fixtures.UnbakcedObject
|
||||
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
||||
import io.kotest.assertions.json.shouldEqualJson
|
||||
import io.kotest.assertions.throwables.shouldThrow
|
||||
|
@ -17,6 +17,9 @@ sourdoughLibrary {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Versions
|
||||
val detektVersion: String by project
|
||||
|
||||
// IMPLEMENTATION
|
||||
|
||||
implementation(projects.kompendiumCore)
|
||||
@ -26,6 +29,9 @@ dependencies {
|
||||
// TESTING
|
||||
|
||||
testImplementation(testFixtures(projects.kompendiumCore))
|
||||
|
||||
// Formatting
|
||||
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
|
||||
}
|
||||
|
||||
testing {
|
||||
|
@ -43,6 +43,7 @@ object NotarizedLocations {
|
||||
name = "NotarizedLocations",
|
||||
createConfiguration = ::Config
|
||||
) {
|
||||
println("hi")
|
||||
val spec = application.attributes[KompendiumAttributes.openApiSpec]
|
||||
val serializableReader = application.attributes[KompendiumAttributes.schemaConfigurator]
|
||||
pluginConfig.locations.forEach { (k, v) ->
|
||||
|
@ -18,9 +18,15 @@ sourdoughLibrary {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Versions
|
||||
val detektVersion: String by project
|
||||
|
||||
api(projects.kompendiumJsonSchema)
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
|
||||
|
||||
// Formatting
|
||||
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
|
||||
|
||||
testImplementation(testFixtures(projects.kompendiumCore))
|
||||
}
|
||||
|
||||
|
@ -16,5 +16,4 @@ object UriSerializer : KSerializer<URI> {
|
||||
override fun serialize(encoder: Encoder, value: URI) {
|
||||
encoder.encodeString(value.toString())
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user