-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Implement message model annotations (#43) * feat - Implement message model annotations * chore - Remove unused dependencies * feat: Process message and schema annotations (#44) * feat - Implement Message annotation processing * feat - Merge annotation components * feat - Add schema annotation processor * refactor - Make annotation processor context dynamic test - Add annotation provider integration test * chore - ktlint format * refactor - Refactor dependency management --------- Co-authored-by: lorenzsimon <[email protected]> * feat: Channel annotation processing (#45) * feat - Add Channel and Operation annotations * feat - Add Channel processing * refactor - Annotation keys to values * chore - Fix confusing test values * refactor: Annotation mapping (#47) * refactor - Annotation mapping improvements * refactor - Add option for inline messages and schemas * refactor - Use classname for channel component keys if autogenerated * fix - Typo * test - Fix Schemas test * feat: Add Kotlin module to model resolver (#48) feat - Add Kotlin module to model resolver * feat: Bind channels to annotation components (#49) * refactor - Context providers * feat - Bind channels to annotation components * refactor - Annotation components binding * chore - Format * chore: Add Spring Boot example application (#63) * chore: Add Spring Boot example application * fix: Java version * fix: Test * chore: Bump dependencies (#65) * chore: Bump dependencies * chore: Bump dependencies * chore: Set Java version in GH actions * fix: Autoconfig migration * fix: Migrate Jakarta * chore: Refactor data objects (#67) * chore: Revert * release: 3.0.3 * pre-release: 3.0.4 * feat: Add Ktor integration (#72) * docs: Update Spring support * pre-release: 3.0.4 (#70) * docs: Link Spring Boot example * Add Ktor integration * Fix content type * Fix test * Fix test * Add Script extension * Add Script extension * Refactor * Add plugin integration test * Add docs for ktor integration --------- Co-authored-by: Lorenz Simon <[email protected]>
- Loading branch information
1 parent
a3dc058
commit 703c7f5
Showing
59 changed files
with
1,150 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openfolder</groupId> | ||
<artifactId>kotlin-asyncapi-parent</artifactId> | ||
<version>3.0.4-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>kotlin-asyncapi-context</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Kotlin AsyncAPI Context</name> | ||
<description>Context module for framework integrations</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.openfolder</groupId> | ||
<artifactId>kotlin-asyncapi-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openfolder</groupId> | ||
<artifactId>kotlin-asyncapi-script</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openfolder</groupId> | ||
<artifactId>kotlin-asyncapi-annotation</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.module</groupId> | ||
<artifactId>jackson-module-kotlin</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.swagger.core.v3</groupId> | ||
<artifactId>swagger-core-jakarta</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.github.classgraph</groupId> | ||
<artifactId>classgraph</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-scripting-jvm-host</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.skyscreamer</groupId> | ||
<artifactId>jsonassert</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
8 changes: 8 additions & 0 deletions
8
...-context/src/main/kotlin/org/openfolder/kotlinasyncapi/context/AsyncApiContextProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.openfolder.kotlinasyncapi.context | ||
|
||
import org.openfolder.kotlinasyncapi.model.AsyncApi | ||
|
||
interface AsyncApiContextProvider { | ||
|
||
val asyncApi: AsyncApi? | ||
} |
17 changes: 17 additions & 0 deletions
17
...capi-context/src/main/kotlin/org/openfolder/kotlinasyncapi/context/PackageInfoProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.openfolder.kotlinasyncapi.context | ||
|
||
import org.openfolder.kotlinasyncapi.model.AsyncApi | ||
|
||
class PackageInfoProvider( | ||
private val applicationPackage: Package? | ||
) : AsyncApiContextProvider { | ||
|
||
override val asyncApi: AsyncApi? by lazy { | ||
AsyncApi().apply { | ||
info { | ||
title(applicationPackage?.implementationTitle ?: "AsyncAPI Definition") | ||
version(applicationPackage?.implementationVersion ?: "SNAPSHOT") | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...syncapi-context/src/main/kotlin/org/openfolder/kotlinasyncapi/context/ResourceProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.openfolder.kotlinasyncapi.context | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import org.openfolder.kotlinasyncapi.model.AsyncApi | ||
|
||
class ResourceProvider(path: String) : AsyncApiContextProvider { | ||
|
||
private val objectMapper = ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL) | ||
|
||
override val asyncApi: AsyncApi? by lazy { | ||
resource?.let { objectMapper.readValue(it, AsyncApi::class.java) } | ||
} | ||
|
||
val resource: String? = javaClass.classLoader.getResource(path)?.readText() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ext/src/main/kotlin/org/openfolder/kotlinasyncapi/context/annotation/AnnotationScanner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.openfolder.kotlinasyncapi.context.annotation | ||
|
||
import io.github.classgraph.ClassGraph | ||
import kotlin.reflect.KClass | ||
|
||
interface AnnotationScanner { | ||
fun scan(classLoader: ClassLoader? = null, scanPackage: String? = null, annotation: KClass<out Annotation>): List<KClass<*>> | ||
} | ||
|
||
class DefaultAnnotationScanner : AnnotationScanner { | ||
override fun scan(classLoader: ClassLoader?, scanPackage: String?, annotation: KClass<out Annotation>): List<KClass<*>> { | ||
val packageClasses = ClassGraph() | ||
.enableAllInfo() | ||
.apply { | ||
if (classLoader != null) { | ||
addClassLoader(classLoader) | ||
} | ||
if (scanPackage != null) { | ||
acceptPackages(scanPackage) | ||
} | ||
} | ||
.scan() | ||
|
||
return packageClasses.getClassesWithAnnotation(annotation.java).standardClasses.map { | ||
it.loadClass().kotlin | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
.../kotlin/org/openfolder/kotlinasyncapi/context/annotation/processor/AnnotationProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.openfolder.kotlinasyncapi.context.annotation.processor | ||
|
||
import org.openfolder.kotlinasyncapi.model.component.Components | ||
|
||
interface AnnotationProcessor<T, U> { | ||
fun process(annotation: T, context: U): Components | ||
} |
6 changes: 2 additions & 4 deletions
6
.../annotation/processor/ChannelProcessor.kt → .../annotation/processor/ChannelProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...xt/annotation/processor/ConverterUtils.kt → ...xt/annotation/processor/ConverterUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...text/annotation/processor/MappingUtils.kt → ...text/annotation/processor/MappingUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
.../annotation/processor/MessageProcessor.kt → .../annotation/processor/MessageProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
...t/annotation/processor/SchemaProcessor.kt → ...t/annotation/processor/SchemaProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.