swagger_parser
swagger_parser copied to clipboard
Regression in 1.24 with dart_mappable and default empty arrays
Steps to reproduce
A field in json that looks like this
"languages": {
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
Is parsed into this
this.languages = [], which cannot be compiled due to error "The default value of an optional parameter must be constant"
Prior to 1.24 it was parsed as
required this.languages,
Expected results
Either the parse result should be required this.languages, or this.languages = const [],
Actual results
Your OpenApi snippet
"languages": {
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
Dart version and used packages versions
Dart 3.8.0, dart_mappable 4.5.0, swagger_parser 1.24.0