-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There isn't a uuid() function for JSONata #672
Comments
Maybe it's not what you're looking for, but you can register your own function for your expression. |
@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. |
I happen to agree with @ipauler - While I am using custom functions for various things and don't find it too much of a hassle to just create my own Given the importance that a UUID function suits the use-case and that it needs to be reliably robust, I'd prefer it not be added to |
Timely comment because I was in the process of preparing a PR for adding this function, specifically the version 4 (random) UUID as specified in https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-4 It uses the built-in crypto API included with node and most browsers (https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID) so it doesn't add any third party dependencies. As with any built-in function, it can be overridden with your own implementation using the mechanism describe above. |
@andrew-coleman I think a basic IETF v4 approach is best, and let others override with their favorite flavors. This gap came up in call with NIST Systems Integration Division and they were baffled as well why UUID wasn't core. This is the right approach. |
#731 is the current proposed approach, but we've ran into the problem of webcrpyto not being considered stable, and therefore available as a global, until Node.js 19. So to adopt this we'd need to drop support below Node.js 20, which is not something we'd want to do while Node.js 18 is still a support LTS release. However, this changes end of April, so we might wait until then, do a major version bump and bring this in. |
I am only just becoming active with |
#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.
The text was updated successfully, but these errors were encountered: