Hi John,

`capnp::SchemaParser` will parse capnp files and give you a
`capnp::ParsedSchema`, which is like `capnp::Schema` but also has the
`getNested()` method which allows you to traverse the whole tree of child
nodes. So it's not just the root node.

That said, it's true that it's not super-convenient to construct a
`CodeGeneratorRequest` from this. You would need to traverse the tree and
flatten it into a list, which is easy enough, but filling in
`requestedFiles` (especially `imports`) might be tricky.

Out of curiosity, why do you need to construct a `CodeGeneratorRequest`?

-Kenton

On Thu, Jun 18, 2020 at 6:15 PM John Demme <teqdr...@gmail.com> wrote:

> Hello all-
>
> I've spent a lot of time digging around the CapnProto C++ code base, but I
> can't figure how to point a function to a textual capnp schema and get out
> the CodeGenRequest. Parsing to a capnp::Schema is not sufficient as that
> class only represents the root node with (AFAICT) no way to access the
> other nodes and other information in the CodeGenRequest. I saw there was
> infrastructure to do this in the compiler, but those header files aren't
> distributed with the library code.
>
> ~John
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to capnproto+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/capnproto/d23c4480-ab9a-4b77-9a5d-02535698bc01o%40googlegroups.com
> <https://groups.google.com/d/msgid/capnproto/d23c4480-ab9a-4b77-9a5d-02535698bc01o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CAJouXQnir82LNvLs3fTDaDwTb1mktiDQVvrLaTZbHxEYkhBn4w%40mail.gmail.com.

Reply via email to