jsonata-js/jsonata

There isn't a uuid() function for JSONata

dubnemo opened this issue · 2 comments

#390 discusses the challenge, but the core issue was solved therefore that could be closed an a new issue to focus on that be created.

The use case: while iterating in a map, a new uuid needs to be generated and assigned to a property for each array entry.

Maybe it's not what you're looking for, but you can register your own function for your expression.
We're using that a lot for our use case, we have a library of functions we're using, all of them are pre-registered before running evaluation.
https://docs.jsonata.org/embedding-extending#expressionregisterfunctionname-implementation-signature

@ipauler the intent of this ticket is to build this function in the core of JSONata. Most transformation languages I have worked with have similar functions built-in.
E.g., DataWeave does this now:
https://docs.mulesoft.com/dataweave/latest/dw-core-functions-uuid
That is only one of many. The recommended goal is to make JSONata more 'enterprise-grade'.