Skip to content

Commit a4df134

Browse files
authored
chore: Bump kotlinx-schema to 0.4.3 and update changelog + test (#266)
- Bump kotlinx-schema to 0.4.3 and update changelog - test: Add test for JSON schema generation from nullable defaults (#263) ### Pre-Submission Checklist - [x] **Self-reviewed** my own code - [x] **Tests added/updated** and passing locally - [x] **Documentation updated** (if needed: README, code comments, etc.) - [ ] **Focused PR**: Single concern, no unrelated changes or "drive-by" fixes - [ ] **Breaking changes documented** (if applicable) - [x] **No debug code**: Removed commented-out code and debug statements
1 parent e22685b commit a4df134

File tree

5 files changed

+54
-3
lines changed

5 files changed

+54
-3
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## 0.4.3
2+
> Published 2026-03-17
3+
4+
### Fixed
5+
- **Java record class support**: reflection schema generator now correctly introspects Java `record` types (#263)
6+
- **Nullable required constructor parameters**: default value extraction no longer silently skips nullable required
7+
parameters when building mock constructor arguments, restoring correct defaults detection for classes with
8+
patterns such as `data class Foo(val tag: String? = "abc", val count: Int? = 5)` (#263)
9+
- **Private constructor filtering**: fallback constructor lookup now skips `private` constructors, preventing
10+
accidental invocation of synthetic or internal-only constructors (#263)
11+
12+
### Dependencies
13+
- Bump `kotest` from 6.1.6 to 6.1.7
14+
15+
---
16+
117
## 0.4.2
218
> Published 2026-03-13
319

examples/gradle-google-ksp/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ name = gradle-google-ksp-example
1212
group=org.jetbrains.kotlinx.examples
1313
version=1.0-SNAPSHOT
1414

15-
kotlinxSchemaVersion=0.4.1
15+
kotlinxSchemaVersion=0.4.3

examples/maven-ksp/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<kotlin.version>2.3.10</kotlin.version>
1717
<maven.compiler.release>25</maven.compiler.release>
1818
<ksp.plugin.version>0.4.0</ksp.plugin.version>
19-
<kotlinx-schema.version>0.4.2</kotlinx-schema.version>
19+
<kotlinx-schema.version>0.4.3</kotlinx-schema.version>
2020
<kotest.version>6.1.7</kotest.version>
2121
<kotlinx-serialization.version>1.10.0</kotlinx-serialization.version>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ksp.useKSP2=true
2020
detekt.use.worker.api = true
2121

2222
group=org.jetbrains.kotlinx
23-
version=0.4.3-SNAPSHOT
23+
version=0.4.4-SNAPSHOT
2424

2525
versionSuffix=SNAPSHOT
2626

kotlinx-schema-generator-json/src/jvmTest/kotlin/kotlinx/schema/generator/json/JavaClassJsonSchemaGeneratorTest.kt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,39 @@ class JavaClassJsonSchemaGeneratorTest {
149149

150150
actualSchema shouldEqualJson expectedSchema
151151
}
152+
153+
@Test
154+
fun `Should generate JsonSchema from nullable defaults`() {
155+
data class Foo(
156+
val tag: String? = "abc",
157+
val count: Int? = 5,
158+
)
159+
// External Java class
160+
val actualSchema = generator.generateSchemaString(Foo::class)
161+
actualSchema shouldEqualJson
162+
$$"""
163+
{
164+
"$schema": "https://json-schema.org/draft/2020-12/schema",
165+
"$id": "Foo",
166+
"type": "object",
167+
"properties": {
168+
"tag": {
169+
"type": [
170+
"string",
171+
"null"
172+
],
173+
"default": "abc"
174+
},
175+
"count": {
176+
"type": [
177+
"integer",
178+
"null"
179+
],
180+
"default": 5
181+
}
182+
},
183+
"additionalProperties": false
184+
}
185+
""".trimIndent()
186+
}
152187
}

0 commit comments

Comments
 (0)