OpenAPITools / OpenAPITools/openapi-generator
Error deserializing
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
When receiving JSON:
[ { "id": 1, "name": "Test", "schedule": { "slots": [ [], [], [], [], [], [], [ { "time_from": "10:30:00", "time_to": "15:45:00" } ] ] } } ]
I get an error after the response:
DioError [unknown]: null I/flutter (19668): │ Error: Deserializing '[{id: 2, name: Test, email: test@gmail.com...' to 'BuiltList' failed due to: Deserializing '[id, 2, name, Test, email, test@gmail.com...' to 'OverviewPlace' failed due to: Deserializing '[slots, [[], [{time_from: 07:00:00, time_to: 14:00:00}, {time_from: 15:00:00,...' to 'Schedule?' failed due to: Deserializing '[[], [{time_from: 07:00:00, time_to: 14:00:00}, {time_from: 15:00:00, time_to...' to 'BuiltList<BuiltList>' failed due to: Deserializing '[]' to 'BuiltList' failed due to: Bad state: No builder factory for BuiltList. Fix by adding one, see SerializersBuilder.addBuilderFactory.
It was solved by adding the code to the serializers.dart file:
..addBuilderFactory( const FullType(BuiltList, [FullType(TimeSlot)]), () => ListBuilder(), )
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names the generated serializers.dart file and shows a nested empty-list deserialization failure. Start by reproducing the response with empty schedule slots and inspecting the generated serializer registrations. Done means the generated client deserializes the nested BuiltList without manually editing serializers.dart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100