Closed Vovanella95 closed 3 years ago
Same issue here. Tried with 1.6.8 Sample openapi schema openapi.txt Array type definition is:
"ListCustomItem": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CustomItem"
}
}
As a result the CustomItem is fine, but ListCustomItem generated code is empty:
@JsonSerializable(explicitToJson: true)
class ListCustomItem {
ListCustomItem();
factory ListCustomItem.fromJson(Map<String, dynamic> json) =>
_$ListCustomItemFromJson(json);
static const fromJsonFactory = _$ListCustomItemFromJson;
static const toJsonFactory = _$ListCustomItemToJson;
Map<String, dynamic> toJson() => _$ListCustomItemToJson(this);
}
ListCustomItem _$ListCustomItemFromJson(Map<String, dynamic> json) {
return ListCustomItem();
}
Map<String, dynamic> _$ListCustomItemToJson(ListCustomItem instance) =>
<String, dynamic>{};
@PKIE As a temporary solution please use https://github.com/epam-cross-platform-lab/swagger-dart-code-generator#response-override-value-map-for-requests-generation
Thank you @fryette Do you know if there is a way to override types for array type properties?
OK, I managed to change the schema generator (probably it was buggy, and now instead creating new ListCustomItem definition it simply defines the response (or internal array) as array of type
So thanks for help, and sorry for bugging ;)
Wrong generation when definigion is an array of objects