-
Notifications
You must be signed in to change notification settings - Fork 10
Add support for Nano ID #614
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
base: main
Are you sure you want to change the base?
Conversation
|
Hiya! Sorry for the late reply, I was on holiday, amongst others. (At a glance) the implementation looks neat, and definitely in line with the rest of the code base. Thank you for that! :) At the moment, I'm a bit on the fence with how I want to include this in the plugin. My dilemma is as follows, and I'd love to hear your opinion on the matter @itsmefox:
I'm also curious about something else, @itsmefox, and please feel free to answer honestly, or to not answer at all if you don't want to: Do you use Randomness primarily for generating UUIDs / NanoIDs, or do you also use Randomness to generate other customisable data types? Your answer would help me understand how users are using Randomness, and would help me make decisions in how I want to lay out the many settings options for users :-) |
|
Hey
I think there is a third option which combines your two approaches. We could make NanoID a subtype of UID. But add UUID and NanoId as two separate templates. So in that case, they use both the UID settings, but are directly visible to the user as separate entries, similar to how it is handled for "Personal Name" and "Lorem Ipsum", which both use the Word type. This approach would also open up the possibility of adding other UID subtypes like Snowflake Id.
In addition to UUID and potentially in the future NanoID, I also often use the String type and create my own custom patterns to generate plausable api keys and other test data. |
|
@itsmefox Sorry for the late reply (again). I think your combined solution of making NanoID a sub-type of (U)UIDs, and just adding multiple default templates is great! I'd definitely be in favour. Would you be willing and would you have time to implement that? The new merge conflicts should be really easy to resolve, either way. And thank you for the answer about how you use Randomness :) |
# Conflicts: # build.gradle.kts # gradle.properties
|
@fwdekker No worries at all! Happy to work on this change. I’ll update the PR with the new subtype approach and the additional default templates. |
Summary
Adds Nano ID (ai/nanoid) as a new generator type with size and alphabet customisation. It uses the Kotlin implementation (nanoid-kotlin) to generate them.
Additional context
Tests and documentation were updated accordingly.