Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for unknown fields #473

Merged
merged 4 commits into from
Jan 15, 2022
Merged

Conversation

Vilsol
Copy link
Collaborator

@Vilsol Vilsol commented Jan 12, 2022

Implements unknown fields as discussed in #437 behind the unknownFields feature flag.

I had to resort to using undocumented API for writing the proto, as it's apparently unintended to be able to just write out arbitrary bytes to the buffer:

(writer as any)['_push'](
  (val: Uint8Array, buf: Buffer, pos: number) => buf.set(val, pos),
  value.length,
  value
);

The test makes sure that decoding -> encoding -> decoding works.

Copy link
Owner

@stephenh stephenh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is great; the changes to main.ts were much smaller/cleaner than I anticipated. Nice!

@stephenh stephenh merged commit 3bb9472 into stephenh:main Jan 15, 2022
stephenh pushed a commit that referenced this pull request Jan 15, 2022
# [1.101.0](v1.100.1...v1.101.0) (2022-01-15)

### Features

* add support for unknown fields ([#473](#473)) ([3bb9472](3bb9472))
@stephenh
Copy link
Owner

🎉 This PR is included in version 1.101.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants