Using additionalProperties:true results in type error in generated code

#12 · open · 0 comments

View on GitHub ↗

timalenustmf

I have a schema Parent.yml as follows: ```yaml type: object properties: test: type: object additionalProperties: true ``` After running the build_runner this results in a type error in the generated `class ParentTest implements OpenApiContent` in the file *.api.openapi.dart The type error from my IDE reads as follows: _The argument type 'Iterable<MapEntry<String, dynamic>>' can't be assigned to the parameter type 'Iterable<MapEntry<String, Object>>'_ ```dart class ParentTest implements OpenApiContent { ParentTest(); factory ParentTest.fromJson(Map<String, dynamic> jsonMap) => _$PersonGroupsFromJson(jsonMap) .._additionalProperties.addEntries( jsonMap.entries.where((e) => !const <String>{}.contains(e.key))); final Map<String, Object> _additionalProperties = <String, Object>{}; } ``` This can be solved by changing the type of `_additionalProperties` to `Map<String, dynamic>`

Comments