Skip to content

Conversation

@itsmefox
Copy link

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.

@fwdekker fwdekker self-assigned this Oct 31, 2025
@fwdekker fwdekker added the feature New feature or request label Oct 31, 2025
@fwdekker
Copy link
Owner

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:

  1. On the one hand, NanoID is quite similar to UUIDs in usage, so it might be cleaner to include it as a sub-type of the existing UUID type. Maybe rename UUID to UID, so the UUID dropdown menu becomes the UID dropdown menu, and then include NanoIDs in that dropdown menu?
  2. On the other hand, users who are looking for NanoIDs might find it annoying that they have to dig deeper to find them. In this case, it would be better to have NanoIDs as a separate type, like what you have in the PR right now.

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 :-)

@itsmefox
Copy link
Author

Hey

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 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.

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 :-)

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.

@fwdekker
Copy link
Owner

@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
@itsmefox
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants