feat: v2-alpha (#112)
There are still some bugs, still some outstanding features, but I don't want to hold this back any longer, that way I can keep the future PRs much more focused
This commit is contained in:
9
kompendium-annotations/Module.md
Normal file
9
kompendium-annotations/Module.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Module kompendium-annotations
|
||||
|
||||
This module houses all annotations that Kompendium uses to provide key metadata when performing reflective analysis.
|
||||
|
||||
It is separated from core predominantly to allow for potential future integrations with [Kotlin Symbol Processing](https://github.com/google/ksp)
|
||||
|
||||
# Package io.bkbn.kompendium.annotations
|
||||
|
||||
Contains all annotations used by Kompendium
|
3
kompendium-annotations/build.gradle.kts
Normal file
3
kompendium-annotations/build.gradle.kts
Normal file
@ -0,0 +1,3 @@
|
||||
plugins {
|
||||
id("io.bkbn.sourdough.library")
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package io.bkbn.kompendium.annotations
|
||||
|
||||
/**
|
||||
* Annotation used to perform field level overrides.
|
||||
* @param name Indicates that a field name override is desired. Often used for camel case to snake case conversions.
|
||||
*/
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class Field(val name: String = "", val description: String = "")
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class FreeFormObject
|
@ -0,0 +1,9 @@
|
||||
package io.bkbn.kompendium.annotations
|
||||
|
||||
/**
|
||||
* Used to indicate that a field in a data class represents an OpenAPI parameter
|
||||
* @param type The type of parameter, must be valid [ParamType]
|
||||
*/
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class Param(val type: ParamType)
|
@ -0,0 +1,11 @@
|
||||
package io.bkbn.kompendium.annotations
|
||||
|
||||
/**
|
||||
* The allowed parameter types as specified by the OpenAPI specification
|
||||
*/
|
||||
enum class ParamType {
|
||||
COOKIE,
|
||||
HEADER,
|
||||
PATH,
|
||||
QUERY
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package io.bkbn.kompendium.annotations
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* This annotation allows users to add additional fields that are not part of the core data model. This should be used
|
||||
* EXTREMELY sparingly. Most useful in supporting a variety of polymorphic serialization techniques.
|
||||
* @param field Name of the extra field to add to the model
|
||||
* @param clazz Class type of the field being added. If this is a complex type, you are most likely doing something
|
||||
* wrong.
|
||||
*/
|
||||
@Repeatable
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class UndeclaredField(val field: String, val clazz: KClass<*>)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class Format(val format: String)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class MaxItems(val items: Int)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class MaxLength(val length: Int)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class MaxProperties(val properties: Int)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class Maximum(val max: String, val exclusive: Boolean = false)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class MinItems(val items: Int)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class MinLength(val length: Int)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class MinProperties(val properties: Int)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class Minimum(val min: String, val exclusive: Boolean = false)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class MultipleOf(val multiple: String)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class Pattern(val pattern: String)
|
@ -0,0 +1,5 @@
|
||||
package io.bkbn.kompendium.annotations.constraint
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class UniqueItems
|
Reference in New Issue
Block a user