googleapis / googleapis/google-cloud-swift

sidekick: swift supports `null` as default values

Open
#444 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
26
Forks
10
Avg merge
12h 56m
Merged PRs (30d)
211

Description

When decoding from ProtoJSON we need to treat `null` as the default value. Note that this works for required, optional, repeated, and map fields:

- For required numeric fields `null` is decoded as `0`
- For required string fields `null` is coded as `""`
- For required bytes fields `null` is decoded as the empty `Data()`.
- For required enum fields `null` is decoded as the default enum value in the enum (there is always one in proto3).
- For optional fields `null` is decoded as `nil`
- For repeated fields `null` is decoded as an empty array.
- For map fields `null` is decoded as an empty dictionary.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.