Skip to content

Commit bd63697

Browse files
committed
resolves #29
1 parent c920f89 commit bd63697

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Guess structure of protobuf binary from raw data, query binary protobuf without
66

77
You can explore your proto binary data [here](https://konsumer.js.org/rawproto/). Use it to view, generate proto/json files, or select how to parse fields.
88

9-
If you are coming form an older version, or anothe rlibrary, check out [migration instructions](#migration).
9+
If you are coming form an older version, or another library, check out [migration instructions](#migration).
1010

1111

1212
## installation
@@ -26,7 +26,7 @@ Install it in your path with `npm i -g rawproto` or use it 1-off with `npx rawpr
2626

2727
### code
2828

29-
You can use it in code like this:
29+
You can use it, as a library, in code like this:
3030

3131
```js
3232
import { readFile } from 'fs/promises'
@@ -95,11 +95,15 @@ Many things (ui, `toJS`, `toProto`, cli) use `queryMap` which is just a map of `
9595
}
9696
```
9797

98-
You can use any types, from above, and set the name to whatever you want.
98+
You can use any types, from above, and set the name to whatever you want. Since it's flat, and JSON doesn;t allow multiple keys with same name, it might help to prefix it, like this:
9999

100-
## protoc
100+
```
101+
102+
```
103+
104+
### protoc
101105

102-
If you already have some of your types defined in a proto file, or just find that easier to make proto in (it generally is much nicer) you can use [protoc-gen-typemap](https://github.com/konsumer/protoc-gen-typemap) to generate typemaps:
106+
If you already have some of your types defined in a proto file, or just find that easier to make proto typemaps in (it generally is much nicer) you can use [protoc-gen-typemap](https://github.com/konsumer/protoc-gen-typemap) to generate typemaps:
103107

104108
```
105109
npm i -g protoc-gen-typemap

ui/src/ProtoDisplay.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ export function ProtoField ({ field }) {
7777
)
7878
}
7979

80+
if (field.renderType === 'bool') {
81+
return (
82+
<div className='block'>
83+
<span className={`mr-2 badge badge-${badgeColors[field.type]}`}>{field.name}</span>
84+
<span className='mr-2 text-gray-500 italic'>{parseLabels[field.renderType]}</span>
85+
<span>{field[field.renderType] ? 'True' : 'False'}</span>
86+
</div>
87+
)
88+
}
89+
8090
try {
8191
return (
8292
<div className='block'>

0 commit comments

Comments
 (0)