mafintosh / mafintosh/protocol-buffers
Unknown wire type: 6
- Dominant language
- JavaScript
- Stars
- 760
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Description
Hi! I'm trying to decode a METADATA.pb from [Google Fonts](https://github.com/google/fonts):
```
name: "Open Sans"
designer: "Steve Matteson"
license: "APACHE2"
category: "SANS_SERIF"
date_added: "2011-02-02"
fonts {
name: "Open Sans"
style: "normal"
weight: 300
filename: "OpenSans-Light.ttf"
post_script_name: "OpenSans-Light"
full_name: "Open Sans Light"
copyright: "Digitized data copyright © 2010-2011, Google Corporation."
}
fonts {
name: "Open Sans"
style: "italic"
weight: 300
filename: "OpenSans-LightItalic.ttf"
post_script_name: "OpenSansLight-Italic"
full_name: "Open Sans Light Italic"
copyright: "Digitized data copyright © 2010-2011, Google Corporation."
}
subsets: "menu"
subsets: "cyrillic"
subsets: "cyrillic-ext"
subsets: "devanagari"
subsets: "greek"
subsets: "greek-ext"
subsets: "latin"
subsets: "latin-ext"
subsets: "vietnamese"
```
With the proto google_font_metadata.proto:
```
message FamilyProto {
required string name = 1;
required string designer = 2;
required string license = 3;
required string category = 4;
required string date_added = 5;
repeated FontProto fonts = 6;
repeated string aliases = 7;
repeated string subsets = 8;
}
message FontProto {
required string name = 1;
required string style = 2;
required int32 weight = 3;
required string filename = 4;
required string post_script_name = 5;
required string full_name = 6;
optional string copyright = 7;
}
```
And I'm getting `Error: Unknown wire type: 6` when I decode like this:
``` js
var messages = protobuf(fs.readFileSync(__dirname + '/google_font_metadata.proto'));
var buf = messages.FamilyProto.decode(fs.readFileSync(__dirname + '/METADATA.pb'));
```
I assume it has something do with the [protocol buffer text format](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.text_format), perhaps? Do I have to do something special in order to enable "text format mode" or something?
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with google_font_metadata.proto and the FamilyProto.decode call, then inspect the decoder's input expectations using METADATA.pb. Compare the text-format file with the binary format accepted by decode; done means the issue's compatibility question is answered and the supported behavior is documented or covered by a focused test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100