Skip to content

Commit

Permalink
fix issue with non-nullable arrays and late init
Browse files Browse the repository at this point in the history
  • Loading branch information
rvowles committed Oct 14, 2023
1 parent 85c32bb commit 683b493
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,6 @@ class DartV3ApiGenerator : DartClientCodegen() {

cp.vendorExtensions["original-default"] = cp.defaultValue

if ((cp.defaultValue == "[]" && cp.isArray) || (cp.defaultValue == "{}" && cp.isMap)) {
cp.defaultValue = "const " + cp.defaultValue
}

if (cp.required || (cp.defaultValue == null && !cp.isNullable)) {
cp.required = true
}
Expand Down Expand Up @@ -434,7 +430,6 @@ class DartV3ApiGenerator : DartClientCodegen() {
private fun correctInternalsOfModels(allModels: MutableMap<String, CodegenModel>) {
allModels.values.forEach { cm ->
cm.vendorExtensions["dartClassName"] = StringUtils.camelize(cm.getClassname())

if (cm.vars != null) {
val arraysWithDefaults = mutableListOf<CodegenProperty>()

Expand Down Expand Up @@ -465,7 +460,7 @@ class DartV3ApiGenerator : DartClientCodegen() {
correctingSettings = correctingSettings.items
}

if ((cp.isArray || cp.isMap) && cp.isNullable && !cp.isInherited && cp.defaultValue != null) {
if ((cp.isArray || cp.isMap) && !cp.isInherited && cp.defaultValue != null) {
arraysWithDefaults.add(cp)
}
}
Expand Down

0 comments on commit 683b493

Please sign in to comment.