Skip to content

Commit b9b9c20

Browse files
committed
1 parent 3fb19fb commit b9b9c20

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/writer/java/DataTypeWriterBase.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ data class PropertyData(
2929
val baseName: String,
3030
val imports: Set<String>,
3131
val propDataType: PropertyDataType
32-
)
32+
) {
33+
fun isRequired(dataType: ModelDataType): Boolean {
34+
return dataType.isRequired(srcPropName)
35+
}
36+
}
3337

3438

3539
abstract class DataTypeWriterBase(

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/writer/java/DataTypeWriterPojo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class DataTypeWriterPojo(
5555
propData.srcPropName,
5656
propData.propName,
5757
propData.propDataType,
58-
dataType.isRequired(propData.srcPropName),
58+
propData.isRequired(dataType),
5959
Access.PRIVATE)
6060

6161
// null (JsonNullable) may have an init value

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/writer/java/DataTypeWriterRecord.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ class DataTypeWriterRecord(
4444
val props = mutableListOf<String>()
4545

4646
propsData.forEach { propData ->
47-
var prop = getProp(
47+
val prop = getProp(
4848
propData.srcPropName,
4949
propData.propName,
5050
propData.propDataType,
51-
dataType.isRequired(propData.srcPropName),
51+
propData.isRequired(dataType),
5252
Access.NONE)
5353

5454
// todo can't init record parameter here

0 commit comments

Comments
 (0)