googleapis / googleapis/api-linter

Misleading wording in https://linter.aip.dev/140/base64 ("base64 fields")

Open
#1,094 3 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: bug
Dominant language
Go
Stars
765
Forks
181
Avg merge
2d 12h
Merged PRs (30d)
3

Description

https://linter.aip.dev/140/base64 says

> This rule tries to enforce that base64 fields use the bytes type, as mandated by [AIP-140](https://aip.dev/140)

This seems misleading. I think it's trying to say that you should not have a "base64 field" at all, but if you need to represent bytes you should just use the "bytes" type directly, without involving any base64.

If you genuinely had the base64 encoding of anything populated in proto field, surely that field would be of type string, since the base64 encoding of anything is a string.

My understanding is that while using gRPC `bytes` will remain as `bytes`, but while using a REST API with JSON, `bytes` will get translated to a string using base64. However, that is only a property of how gRPC maps to REST API with JSON, and is not a good enough reason to refer to any `bytes` field as "a base64 field".

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.