Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Omit property names #130

Copy link
Copy link
Open
Open
Copy link
@hpx7

Description

@hpx7
Issue body actions

I'm using msgpack to transmit objects with a fixed schema, so it feels wasteful to encode the property names with each payload. Is there some way to provide some schema information to the encoder/decoder during initialization so that property names can be excluded from the serialization output?

Proposal of what this api could look potentially like:

import { ValueOnlyEncoder, ValueOnlyDecoder } from "@msgpack/msgpack";

const schema = ... // some representation of your object schema, contains the property names
const encoder = new ValueOnlyEncoder(schema);
const decoder = new ValueOnlyDecoder(schema);

const data = { foo: [1, 2, 3], bar: "baz" };

const encoded = encoder.encode(data); // fails if data doesn't conform to schema
const decoded = decoder.decode(encoded);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.