Skip to content

accessing enums #39

@sachnk

Description

@sachnk

Hi --

Given the following enum in my schema:

enum MyEnum {
  foo @0;
  bar @1;
}

How do I access the corresponding numerical (or string) values for MyEnum? When I do the following:

...
const capnp = require("capnp");
const schema = capnp.import(__dirname + "/schema.capnp");
console.log(schema);

I see output that looks like:

capnp::Schema {
  typeId: '16659730972699922233',
  MyEnum: capnp::Schema { typeId: '11935489294493185729' },
...

So, there doesn't appear to be a way to access the values of the enum. Which means if I want to use the enum values in my node.js app, I can't really do it -- am I missing something?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions