Hi!
Is your feature request related to a problem? Please describe.
Our server supports PATCH with absent fields.
Absent is not like null, it means field is not changed, setting to null means field is set to null (if nullable).
Describe the solution you'd like
I see generated Java client can have JsonNullable which supports isPresent. If we had something similar in Dart then we could make requests with omitted fields, e.g.,
// name omitted
final p1 = UserPatch();
// name explicit null
final p2 = UserPatch(name: const JsonNullable.of(null));
// name has value
final p3 = UserPatch(name: const JsonNullable.of('Alice'));
Could be set by a flag (e.g., --openApiNullable=true) and supported at least for dart-dio with json_serializable.
Describe alternatives you've considered
- Field masks (updateMask): works, but changes API shape.
- Having Option-like things in openapi spec is messy.
- JSON Merge Patch + manual maps: works, but loses typing and is messy.
- Custom sidecar generator thing to emit Option-style (Rust Option) Patch types: solves it locally, not great for the ecosystem, custom post-generator mess.
Additional context
Similar to what Java already has, just for Dart.
I could look at making a PR if there is agreement that this feature would be nice.
Hi!
Is your feature request related to a problem? Please describe.
Our server supports PATCH with absent fields.
Absent is not like null, it means field is not changed, setting to null means field is set to null (if nullable).
Describe the solution you'd like
I see generated Java client can have
JsonNullablewhich supportsisPresent. If we had something similar in Dart then we could make requests with omitted fields, e.g.,Could be set by a flag (e.g.,
--openApiNullable=true) and supported at least for dart-dio with json_serializable.Describe alternatives you've considered
Additional context
Similar to what Java already has, just for Dart.
I could look at making a PR if there is agreement that this feature would be nice.