ProtoDef-io / ProtoDef-io/node-protodef

Option to fill in zero bytes for fixed size data types when undefined?

Open
#81 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
35
Forks
25
Avg merge
4d 3m
Merged PRs (30d)
2

Description

Oh, sorry about custom type it is just an example, I think this should be an option for any type that can have a count set to a fixed number.

If you have a definition with a fixed size.

{
  "name": "foo",
  "type": [
    "fcstring",
    {
      "count": 4,
      "trim": true
    }
  ]
}

And wanted to serialize some object where it is undefined
{}

Then the buffer should zero fill.

<Buffer 00 00 00 00>

Example with buffer data type.

{
  "name": "foo",
  "type": [
    "buffer",
    {
      "count": 4
    }
  ]
}

<Buffer 00 00 00 00>

And applicable to arrays as well.

Would such an option be possible?
Maybe when setting up the serializer.

Contributor guide

No contributing guide indexed for this repository

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 serializer setup and the handling for fixed-count types. Add coverage for undefined fixed-size fcstring and buffer values, including arrays, and verify that serialization produces the requested zero-filled buffers. The issue does not name specific files or tests, so repository exploration is required.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
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.