From bec7f1344570b4fe0cf24f012f061f200d060b9d Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Thu, 30 Oct 2025 17:38:40 +0100 Subject: [PATCH 1/3] amend bytes dtype --- data-types/bytes/README.md | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/data-types/bytes/README.md b/data-types/bytes/README.md index 469fc93..15338ee 100644 --- a/data-types/bytes/README.md +++ b/data-types/bytes/README.md @@ -2,13 +2,20 @@ Defines a data type for variable-length byte strings. -## Permitted fill values +## Fill value encoding -The value of the `fill_value` metadata key must be an array of byte values. +The value of the `fill_value` metadata key must be one of: +- an array of integers from the closed interval `[0, 255]`, where each value encodes a byte from a byte string. +- a string produced by applying [base64 encoding](https://en.wikipedia.org/wiki/Base64) to a bytes string. -## Example +Implementations SHOULD default to the form. -For example, the array metadata below specifies that the array contains variable-length byte strings: +## Examples + +### Array fill value encoding + +The example below shows a fragment of an array metadata document using the `bytes` data type. The +fill value is the byte string `0x01 0x02 0x03` encoded as an array of integers: ```json { @@ -19,14 +26,29 @@ For example, the array metadata below specifies that the array contains variable }], } ``` +### String fill value encoding + +The example below shows a fragment of an array metadata document using the `bytes` data type. The +fill value is the byte string `0x01 0x02 0x03` encoded as a string using base64: + +```json +{ + "data_type": "bytes", + "fill_value": "AQID", + "codecs": [{ + "name": "vlen-bytes" + }], +} +``` -## Notes +## Codec compatibility -Currently, this data type is only compatible with the [`"vlen-bytes"`](../../codecs/vlen-bytes/README.md) codec. +This data type is compatible with any codec that can encode variable-length sequences of bytes. +For example, the [`"vlen-bytes"`](../../codecs/vlen-bytes/README.md) codec. ## Change log -No changes yet. +- Addition of the string-based fill value encoding. ## Current maintainers From be46425c708e37583dd665bf5d9af8907550fd61 Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Thu, 30 Oct 2025 17:44:48 +0100 Subject: [PATCH 2/3] typo --- data-types/bytes/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-types/bytes/README.md b/data-types/bytes/README.md index 15338ee..0f84b64 100644 --- a/data-types/bytes/README.md +++ b/data-types/bytes/README.md @@ -6,7 +6,7 @@ Defines a data type for variable-length byte strings. The value of the `fill_value` metadata key must be one of: - an array of integers from the closed interval `[0, 255]`, where each value encodes a byte from a byte string. -- a string produced by applying [base64 encoding](https://en.wikipedia.org/wiki/Base64) to a bytes string. +- a string produced by applying [base64 encoding](https://en.wikipedia.org/wiki/Base64) to a byte string. Implementations SHOULD default to the form. From 9b7d71a502b67419a0d8127f1ba8365cce70c5c8 Mon Sep 17 00:00:00 2001 From: Davis Bennett Date: Fri, 31 Oct 2025 13:22:56 +0100 Subject: [PATCH 3/3] Update README.md --- data-types/bytes/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-types/bytes/README.md b/data-types/bytes/README.md index 0f84b64..06ea2a0 100644 --- a/data-types/bytes/README.md +++ b/data-types/bytes/README.md @@ -8,7 +8,7 @@ The value of the `fill_value` metadata key must be one of: - an array of integers from the closed interval `[0, 255]`, where each value encodes a byte from a byte string. - a string produced by applying [base64 encoding](https://en.wikipedia.org/wiki/Base64) to a byte string. -Implementations SHOULD default to the form. +As the string form is more compact, it may be preferred where brevity is desired. ## Examples