-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: treat nested enums as enums and not messages (#87)
The `defineModule` function wasn't marking nested enums as such so update it to recursively look at nested subtypes when marking types as optional, messages and/or enums.
- Loading branch information
1 parent
0e5f41b
commit 3af689b
Showing
12 changed files
with
597 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// from https://github.com/ipfs/go-bitswap/blob/master/message/pb/message.proto | ||
syntax = "proto3"; | ||
|
||
message Message { | ||
|
||
message Wantlist { | ||
enum WantType { | ||
Block = 0; | ||
Have = 1; | ||
} | ||
|
||
message Entry { | ||
bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0) | ||
int32 priority = 2; // the priority (normalized). default to 1 | ||
optional bool cancel = 3; // whether this revokes an entry | ||
WantType wantType = 4; // Note: defaults to enum 0, ie Block | ||
bool sendDontHave = 5; // Note: defaults to false | ||
} | ||
|
||
repeated Entry entries = 1; // a list of wantlist entries | ||
bool full = 2; // whether this is the full wantlist. default to false | ||
} | ||
|
||
message Block { | ||
bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length) | ||
bytes data = 2; | ||
} | ||
|
||
enum BlockPresenceType { | ||
Have = 0; | ||
DontHave = 1; | ||
} | ||
message BlockPresence { | ||
bytes cid = 1; | ||
BlockPresenceType type = 2; | ||
} | ||
|
||
Wantlist wantlist = 1; | ||
repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0 | ||
repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0 | ||
repeated BlockPresence blockPresences = 4; | ||
int32 pendingBytes = 5; | ||
} |
Oops, something went wrong.