Just spent a while tracing a bug in some code which was meant to add a namespaced identifier to an already-existing ROCrate, and I forgot to add the .index() step after initialising the object from the raw JSON-LD.
This fails silently - ie it lets you call addIdentifier, but doesn't complain or throw an error, and the JSON-LD written out by the last line is unchanged.
It would be better if either indexing were automatic - the method isn't async, so it could be in the constructor - or if methods which depended on it having been called should call it themselves (better) or throw an error if it hasn't been called (not good)
Just spent a while tracing a bug in some code which was meant to add a namespaced identifier to an already-existing ROCrate, and I forgot to add the .index() step after initialising the object from the raw JSON-LD.
This fails silently - ie it lets you call addIdentifier, but doesn't complain or throw an error, and the JSON-LD written out by the last line is unchanged.
Adding the index() makes it work:
It would be better if either indexing were automatic - the method isn't async, so it could be in the constructor - or if methods which depended on it having been called should call it themselves (better) or throw an error if it hasn't been called (not good)