Skip to content

Commit 2bf2107

Browse files
committed
Split openapi support in two modules, to avoid adding dependencies needed only for code-generation to project runtime classpath
1 parent 09964cd commit 2bf2107

File tree

8 files changed

+76
-42
lines changed

8 files changed

+76
-42
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dependencies {
5353
api(project(":core"))
5454
api(project(":dataframe-arrow"))
5555
api(project(":dataframe-excel"))
56-
api(project(":dataframe-openapi"))
56+
api(project(":dataframe-openapi-runtime"))
5757
api(project(":dataframe-jdbc"))
5858

5959
kover(project(":core"))
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
plugins {
2+
alias(libs.plugins.kotlin.jvm)
3+
alias(libs.plugins.ktlint)
4+
alias(libs.plugins.publisher)
5+
alias(libs.plugins.jupyter.api)
6+
}
7+
8+
group = "org.jetbrains.kotlinx"
9+
10+
repositories {
11+
mavenCentral()
12+
}
13+
14+
dependencies {
15+
api(project(":core"))
16+
}
17+
18+
kotlinPublications {
19+
publication {
20+
publicationName = "dataframeOpenApiRuntime"
21+
artifactId = project.name
22+
description = "OpenAPI support for Kotlin Dataframe"
23+
packageName = artifactId
24+
}
25+
}
26+
27+
kotlin {
28+
explicitApi()
29+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.jetbrains.kotlinx.dataframe.io
2+
3+
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
4+
import org.jetbrains.kotlinx.dataframe.api.KeyValueProperty
5+
6+
/**
7+
* A [DataSchema] interface can implement this if it represents a map-like data schema (so key: value).
8+
* Used in OpenAPI to represent objects with 'just' additionalProperties of a certain type.
9+
*/
10+
public interface AdditionalProperty<T> : KeyValueProperty<T> {
11+
12+
/** Key of the property. */
13+
override val key: String
14+
15+
/** Value of the property. */
16+
override val value: T
17+
18+
public companion object
19+
}

dataframe-openapi/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ repositories {
2121

2222
dependencies {
2323
api(project(":core"))
24+
api(project(":dataframe-openapi-runtime"))
2425

2526
implementation(libs.sl4j)
2627
implementation(libs.kotlinLogging)
@@ -42,7 +43,7 @@ kotlinPublications {
4243
publication {
4344
publicationName = "dataframeOpenApi"
4445
artifactId = project.name
45-
description = "OpenAPI support for Kotlin Dataframe"
46+
description = "OpenAPI code generation support for Kotlin Dataframe"
4647
packageName = artifactId
4748
}
4849
}
Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,30 @@
11
package org.jetbrains.kotlinx.dataframe.io
22

3-
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
4-
import org.jetbrains.kotlinx.dataframe.api.KeyValueProperty
53
import org.jetbrains.kotlinx.dataframe.codeGen.FieldType
64
import org.jetbrains.kotlinx.dataframe.codeGen.Marker
75
import org.jetbrains.kotlinx.dataframe.codeGen.MarkerVisibility
86
import org.jetbrains.kotlinx.dataframe.codeGen.ValidFieldName
97

10-
/**
11-
* A [DataSchema] interface can implement this if it represents a map-like data schema (so key: value).
12-
* Used in OpenAPI to represent objects with 'just' additionalProperties of a certain type.
13-
*/
14-
public interface AdditionalProperty<T> : KeyValueProperty<T> {
15-
16-
/** Key of the property. */
17-
override val key: String
18-
19-
/** Value of the property. */
20-
override val value: T
21-
22-
public companion object {
23-
internal fun getMarker(typeArguments: List<String>) =
24-
Marker(
25-
name = AdditionalProperty::class.qualifiedName!!,
26-
isOpen = false,
27-
fields = listOf(
28-
generatedFieldOf(
29-
fieldName = ValidFieldName.of(AdditionalProperty<*>::key.name),
30-
columnName = AdditionalProperty<*>::key.name,
31-
overrides = false,
32-
fieldType = FieldType.ValueFieldType(String::class.qualifiedName!!),
33-
),
34-
generatedFieldOf(
35-
fieldName = ValidFieldName.of(AdditionalProperty<*>::`value`.name),
36-
columnName = AdditionalProperty<*>::`value`.name,
37-
overrides = false,
38-
fieldType = FieldType.ValueFieldType(Any::class.qualifiedName!! + "?"),
39-
),
40-
),
41-
superMarkers = emptyList(),
42-
visibility = MarkerVisibility.EXPLICIT_PUBLIC,
43-
typeParameters = emptyList(),
44-
typeArguments = typeArguments,
45-
)
46-
}
47-
}
8+
internal fun AdditionalProperty.Companion.getMarker(typeArguments: List<String>) =
9+
Marker(
10+
name = AdditionalProperty::class.qualifiedName!!,
11+
isOpen = false,
12+
fields = listOf(
13+
generatedFieldOf(
14+
fieldName = ValidFieldName.of(AdditionalProperty<*>::key.name),
15+
columnName = AdditionalProperty<*>::key.name,
16+
overrides = false,
17+
fieldType = FieldType.ValueFieldType(String::class.qualifiedName!!),
18+
),
19+
generatedFieldOf(
20+
fieldName = ValidFieldName.of(AdditionalProperty<*>::`value`.name),
21+
columnName = AdditionalProperty<*>::`value`.name,
22+
overrides = false,
23+
fieldType = FieldType.ValueFieldType(Any::class.qualifiedName!! + "?"),
24+
),
25+
),
26+
superMarkers = emptyList(),
27+
visibility = MarkerVisibility.EXPLICIT_PUBLIC,
28+
typeParameters = emptyList(),
29+
typeArguments = typeArguments,
30+
)

plugins/dataframe-gradle-plugin/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ val integrationTestTask = task<Test>("integrationTest") {
117117
dependsOn(":dataframe-excel:publishToMavenLocal")
118118
dependsOn(":dataframe-jdbc:publishToMavenLocal")
119119
dependsOn(":dataframe-openapi:publishToMavenLocal")
120+
dependsOn(":dataframe-openapi-runtime:publishToMavenLocal")
120121
dependsOn(":publishApiPublicationToMavenLocal")
121122
dependsOn(":dataframe-arrow:publishDataframeArrowPublicationToMavenLocal")
122123
dependsOn(":dataframe-excel:publishDataframeExcelPublicationToMavenLocal")

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ plugins {
4141
}
4242
include("dataframe-excel")
4343
include("core")
44+
include("dataframe-openapi-runtime")

0 commit comments

Comments
 (0)