OpenAPITools / OpenAPITools/openapi-generator

[REQ] Dart-dio enable include_if_null option or at least don't pass it on every json key

Open
#20,608 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

Right now, every JsonKey attribute on every single model has the include_if_null set to false. This means that there is no way to override it as in the build.yaml file. We need it because our api requires all fields even if null to be passed.

Describe the solution you'd like

Please give a defaulted to true option in the config additionalProperties that can set this. I would suggest: true, false, and default which defaults to the value in the build.yaml

Also I'd like to request that the build.yaml doesn't get touched and just gives a warning if it already exists.
Same for ananlysis_options.yaml

It force updating these 2 means we have to undo the overwrites every time for stuff that we use in our solution.

Describe alternatives you've considered

I've tried setting in build.yaml but it is ignored because it's actively set on every property.
Only other solution is a mass find and replace.

Additional context

In general I'd suggest that the tool should be minimally invasive to only set the bar minimum of stuff that is necessary to work and nothing else. Everything else should be a build.yaml option and build.yaml should be left alone if it exists for this reason.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Dart-dio generator configuration handling and the templates that emit JsonKey attributes. Review how additionalProperties, build.yaml, and analysis_options.yaml are currently processed, then identify the relevant generation tests if present. Done means the requested include_if_null behavior and non-invasive configuration handling are covered without relying on manual replacement.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.