Optional fields are not typed as optiona...
# spicedb
n
Hey all, Ive been integrating spicedb into our system and using the node-js client. I've noticed a lot of fields are documented and named as
optional
in the api but the type in the object is not optional. Is this a bug? I opened an issue on GH as well: https://github.com/authzed/authzed-node/issues/261
y
no; it's impedance mismatch between how Protobuf describes unset values (which is the same as the zero value) and how Typescript describes zero values. the author of
protobuf-ts
, which we use to generate our client, chose to represent the fields as non-optional.
if you use the
.create()
methods on the message types you can avoid having to specify the optional fields
7 Views