-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
It would be nice to have examples of working with any List<T>
or Data
types.
Right now I don't understand how to correctly assign values to List keys from the generated schema.
The only way I've been able to work with Lists
has been to use _private
methods
const message = new capnp.
const requestData = message.initRoot(RequestData);
const headers = requestData._initHeaders(parsedHeaders.length);
parsedHeaders.forEach(({ key, value }, i) => {
const h = headers.get(i);
h.key = key;
h.value = value;
});
But trying the following leads to errors both from typescripts due to type mismatch and also at runtime TypeError: Cannot read properties of undefined (reading 'isWordZero')
:
requestData.headers = parsedHeaders.map(({ key, value }) => {
return { key, value };
});
Also, how to deserialize string each values from the List
of structs
?
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation