-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Use UUID version 5 for node IDs in source/transformer plugins #1853
Comments
I think we do some amount of regex'ing off the id as a path for documentation on www. but overall I think it's a good idea :) |
Who wrote that code??? They should be fired! ;-) Yeah, though we should probably make this change as part of v2. |
it should already be fine to do deep filtering right e.g. |
Hi, I am not sure if I am doing this wrong, but I found it quite useful to be able to specify my own id for a source plugin that used relational database tables. I could make the id based on the table name, row id and a name for my plugin (perhaps with an instance number if it was reusable). Then I don't need to create any hash maps to keep track of the ___NODE relations in the plugin and they can be generated based on the data. It is also easier to debug the id with an error message something like:
|
@arlair could you create an issue for the error message? Sounds like a really helpful improvement! |
@KyleAMathews The error already exists :) I was just showing how useful it became when I was able to specify a custom Gatsby id based on what should be unique information, rather than a new generated UUID id that would be harder to identify. One option might be to build into the API a postfix for the Gatsby Id based on the plugin name and instance and maybe node type? When I first started trying to build a Gatsby plugin, I assumed I was meant to be passing in my own id and it would make it unique based on my plugin instance and the node I think I found it confusing because what turned out to be the Gatsby id was called |
I'm taking a go at this one, just FYI. |
Thanks @danielfarrell! |
Also sent you an invite to Gatsby's core team so you can assign yourself to issues in the future :-) |
Fixed in the PR, closing this |
@calcsam @danielfarrell's PR was just to add the new helper function to v1 so this issue isn't done yet as we need to convert source/transformer plugins in v2 over to use UUIDs for ids. |
Is there a process that changes flow from master to v2? I can finish this up for v2, but didn't want to duplicate that code if it would flow through. |
Yeah, I merge them in :-) Lemme do that real quick. |
merged |
This was pointed out on Discord https://www.npmjs.com/package/uuid#version-5
Node IDs should be a) globally unique and b) meaningless so people don't rely on them for anything. Standardizing on UUID version 5 seems like a good way to accomplish this.
Thoughts?
The text was updated successfully, but these errors were encountered: