-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
1 parent
f1c1d00
commit ecbc202
Showing
59 changed files
with
1,157 additions
and
255 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
Oops, something went wrong.