planetscale / planetscale/vtprotobuf

Support DiscardUnknown fields with UnmarshalVT

Open
#17 0 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
1.1k
Forks
112
PR merge metrics
No merged PRs in 30d

Description

https://pkg.go.dev/google.golang.org/protobuf/proto#UnmarshalOptions

Currently UnmarshalVT tracks unknownFields:

default:
 			iNdEx = preIndex
 			skippy, err := skip(dAtA[iNdEx:])
 			if err != nil {
 				return err
 			}
 			if (skippy < 0) || (iNdEx+skippy) < 0 {
 				return ErrInvalidLength
 			}
 			if (iNdEx + skippy) > l {
 				return io.ErrUnexpectedEOF
 			}
 			m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) <----
 			iNdEx += skippy

It would be helpful to have an option to discard these.

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 the UnmarshalVT entry point and the unknownFields handling shown in the issue, then read the linked protobuf UnmarshalOptions documentation. Done means UnmarshalVT supports an option that discards unknown fields instead of retaining them.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
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.