~bduggan/raku-protobuf

ref: 4928ccd4ed1b64b5cef334ce173153eb7d1fa4a0 raku-protobuf/script/protoc.raku -rwxr-xr-x 596 bytes
4928ccd4Brian Duggan fix field options, support reserved enums 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env raku

use Protobuf;

my $p = parse-proto($*ARGFILES.slurp);

for $p.services -> $svc {
  say "service name " ~ $svc.name;
  for $svc.endpoints -> $e {
    say " endpoint  " ~ $e.name;
    say '  request params ' ~ $e.request.name;
    for $e.request.fields -> $f {
      say '   name : ' ~ $f.name;
      say '   type : ' ~ $f.type;
      say ' repeated' if $f.repeated;
    }
    say '  response params ' ~ $e.response.name;
    for $e.response.fields -> $f {
      say '   name : ' ~ $f.name;
      say '   type : ' ~ $f.type;
      say ' repeated' if $f.repeated;
    }
  }
}