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:
Ryan Brink
2022-01-02 23:15:15 -05:00
committed by GitHub
parent d66880f9b2
commit c29567114d
229 changed files with 9172 additions and 7233 deletions

View 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

View File

@ -0,0 +1,3 @@
plugins {
id("io.bkbn.sourdough.library")
}

View File

@ -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 = "")

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class FreeFormObject

View File

@ -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)

View File

@ -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
}

View File

@ -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<*>)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class Format(val format: String)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class MaxItems(val items: Int)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class MaxLength(val length: Int)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class MaxProperties(val properties: Int)

View File

@ -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)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class MinItems(val items: Int)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class MinLength(val length: Int)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class MinProperties(val properties: Int)

View File

@ -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)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class MultipleOf(val multiple: String)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class Pattern(val pattern: String)

View File

@ -0,0 +1,5 @@
package io.bkbn.kompendium.annotations.constraint
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.PROPERTY)
annotation class UniqueItems