#2521·capnproto

underscores in method signature isn't rejected by capnp compile

Author: Oyami-SrkCreated Jan 20, 2026Updated Jan 20, 2026

IIUC, underscores are generally not allowed for declaration names, and when underscores are used in type definitions, the following error message would appear:

error: Cap'n Proto declaration names should use camelCase and must not contain underscores. (Code generators may convert names to the appropriate style for the target language.)

However, the following Cap'n Proto schema is valid for capnpc:

capnp
interface Foo {
    do @0 (arg :Text, arg_ :UInt32, arg__ :Data) -> (ret :Data, ret_ :UInt64, ret__ :Text);
}

Since method parameters and returns are treated as "inlined" struct definition, does this mean the code generator should handle this special case when converting the fields' name for a struct from camelCase, since we have two different kinds of names?

If it's a bug, I'm more than happy to provide a patch to fix that.