gibahjoe / openapi-generator-dart

Openapi Generator for Dart/Flutter
BSD 3-Clause "New" or "Revised" License
112 stars 29 forks source link

nullable array fields are not handled properly in the generated `fromJson` #140

Open alexpyc opened 3 months ago

alexpyc commented 3 months ago

Description of the bug

A field is defined as nullable array. Yet it will be generated to have empty List in dart which causes an issue as there is a difference between null and empty List in my case.

Steps to reproduce

SomeObject:
    type: object
    properties:
        category_ids:
            nullable: true
            type: array
            items:
                type: string

Expected behavior

SomeObject currently has the field categoryIds which is nullable List in dart. However it is expected that in fromJson, it can differentiate between null and empty array

Logs

No response

Screenshots

No response

Platform

Linux

Library version

4.13.1

Flutter version

3.10.6

Flutter channel

stable

Additional context

No response