mcollina / mcollina/msgpack5

This implementation does not strictly adhere to the spec

Open
#10 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
499
Forks
77
PR merge metrics
No merged PRs in 30d

Description

According to this point: https://github.com/msgpack/msgpack/blob/master/spec.md#serialization

If an object can be represented in multiple possible output formats, serializers SHOULD use the format which represents the data in the smallest number of bytes.

I'm quite sure that the issue is mainly related to the spec itself that does not correctly exploits some strings representation well known and largely used (I'm going to submit a proposal for a few new types which can be highly compressed).
Even though the spec does not define the behavior in regard of predefined types in cases when applications want to override the default representation and are able to compress the data more than the standard serializer does, I suspect that each implementation should let the client to offer a different serializer for any of the predefined and handled type.

For example a client which knows its strings adhere to a well defined pattern can exploit the fact and the implementation should choose between the two different approaches using "the format which represents the data in the smallest number of bytes".

This implementation neither lets user defined functions to be used instead of the default ones nor lets the clients to propose a different approach.
It prefers the default one and that's all. A different approach could be appreciated.

Contributor guide

Open the contributing guide

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 with spec.md#serialization and then locate the serializer entry point in this JavaScript/node.js implementation. A complete change would need a defined way for clients to provide alternate serializers and tests proving that the smaller representation is selected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.