Skip to content

Commit a08622e

Browse files
committed
adding default value to jsonschema
1 parent 10b63db commit a08622e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/kotlin/wu/seal/jsontokotlin/utils/classgenerator/DataClassGeneratorByJSONSchema.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package wu.seal.jsontokotlin.utils.classgenerator
22

33
import wu.seal.jsontokotlin.JSON_SCHEMA_FORMAT_MAPPINGS
44
import wu.seal.jsontokotlin.model.classscodestruct.*
5+
import wu.seal.jsontokotlin.model.codeelements.getDefaultValue
56
import wu.seal.jsontokotlin.model.jsonschema.JsonObjectDef
67
import wu.seal.jsontokotlin.model.jsonschema.JsonSchema
78
import wu.seal.jsontokotlin.model.jsonschema.PropertyDef
@@ -57,8 +58,7 @@ class DataClassGeneratorByJSONSchema(private val rootClassName: String, private
5758
val (jsonClassName, realDef) = getRealDefinition(jsonProp)
5859
resolveTypeClass(realDef.typeString, jsonClassName, realDef, propertyName)
5960
}
60-
// val value = if (isRequired) getDefaultValue(typeClass.name) else null
61-
val value = null
61+
val value = if (isRequired) getDefaultValue(typeClass.name) else null
6262
return Property(
6363
originName = propertyName,
6464
originJsonValue = value,

0 commit comments

Comments
 (0)