Skip to content

Commit 40c0113

Browse files
authored
Merge pull request #916 from Kotlin/openapi-runtime
Split OpenAPI in module needed for user projects and module needed for code-generation
2 parents a5a2311 + 92ab4dc commit 40c0113

40 files changed

+112
-66
lines changed

core/build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,10 @@ tasks.withType<Jar> {
266266
}
267267

268268
// modify all publishing tasks to depend on `changeJarTask` so the sources are swapped out with generated sources
269-
tasks.named { it.startsWith("publish") }.configureEach {
270-
dependsOn(processKDocsMain, changeJarTask)
269+
tasks.configureEach {
270+
if (name.startsWith("publish")) {
271+
dependsOn(processKDocsMain, changeJarTask)
272+
}
271273
}
272274

273275
// Exclude the generated/processed sources from the IDE

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/Integration.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ internal class Integration(private val notebook: Notebook, private val options:
181181
"org.jetbrains.kotlinx:dataframe-jdbc:$version",
182182
"org.jetbrains.kotlinx:dataframe-arrow:$version",
183183
"org.jetbrains.kotlinx:dataframe-openapi:$version",
184+
"org.jetbrains.kotlinx:dataframe-openapi-generator:$version",
184185
)
185186
}
186187

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
plugins {
2+
with(libs.plugins) {
3+
alias(kotlin.jvm)
4+
alias(publisher)
5+
alias(serialization)
6+
alias(kover)
7+
alias(ktlint)
8+
alias(jupyter.api)
9+
}
10+
}
11+
12+
group = "org.jetbrains.kotlinx"
13+
14+
val jupyterApiTCRepo: String by project
15+
16+
repositories {
17+
mavenLocal()
18+
mavenCentral()
19+
maven(jupyterApiTCRepo)
20+
}
21+
22+
dependencies {
23+
api(project(":core"))
24+
api(project(":dataframe-openapi"))
25+
26+
implementation(libs.sl4j)
27+
implementation(libs.kotlinLogging)
28+
implementation(libs.kotlin.reflect)
29+
implementation(libs.kotlinpoet)
30+
api(libs.swagger) {
31+
// Fix for Android
32+
exclude("jakarta.validation")
33+
}
34+
35+
testApi(project(":core"))
36+
testImplementation(libs.junit)
37+
testImplementation(libs.kotestAssertions) {
38+
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
39+
}
40+
}
41+
42+
kotlinPublications {
43+
publication {
44+
publicationName = "dataframeOpenApi"
45+
artifactId = project.name
46+
description = "OpenAPI code generation support for Kotlin Dataframe"
47+
packageName = artifactId
48+
}
49+
}
50+
51+
kotlin {
52+
explicitApi()
53+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.jetbrains.kotlinx.dataframe.io
2+
3+
import org.jetbrains.kotlinx.dataframe.codeGen.FieldType
4+
import org.jetbrains.kotlinx.dataframe.codeGen.Marker
5+
import org.jetbrains.kotlinx.dataframe.codeGen.MarkerVisibility
6+
import org.jetbrains.kotlinx.dataframe.codeGen.ValidFieldName
7+
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+
)

0 commit comments

Comments
 (0)