feat: Allow dots in organization/scope names#1218
feat: Allow dots in organization/scope names#1218philkunz wants to merge 3 commits intojsr-io:mainfrom
Conversation
Updates validation rules to allow dots (.) in organization names while maintaining backward compatibility with existing names. Backend changes: - Allow dots in ScopeName validation (api/src/ids.rs:30) - Prevent leading/trailing dots (e.g., .org, test.) - Prevent consecutive dots (e.g., foo..bar) - Add new error variants for dot validation - Add comprehensive test coverage for dot patterns Frontend changes: - Update regex to allow dots (frontend/utils/ids.ts:9) - Remove underscore support to match backend validation - Add validation for leading/trailing dots - Add validation for consecutive dots - Update error messages for consistency Valid examples: my.org, foo.bar, foo.bar.baz, org.name-123 Invalid examples: .foo, foo., foo..bar
|
While I don't think allowing dots in scope names is wrong in principle, it provides some challenges beyond just widening the allowed characters on the jsr website and backend. @philkunz Maybe discuss this with the JSR maintainers during their open office meeting: https://discord.gg/V3z7A25S?event=1388890175240667197 These are the problems I can think of: On Windows machines, it is problematic to install packages using a dot in their name. I am not sure if wrapping the package name in quotes has effects on other operating systems The jsr CLI tool will also need to be modified, as it does its own check for valid scope/package names here: https://github.com/jsr-io/jsr-npm/blob/main/src/utils.ts
(Maybe |
|
I don't really think this is desirable. Most orgs have a name (not just a URL) so I don't see why this is needed. Also, this isn't allowed on npm. So my 2c are that I'm against this. |
|
@KnorpelSenf Since when are dots not allowed on npm? They are!!!! All foss.global scopes have dots on npm and mirror the project domain. It is allowed on gitlab, it is allowed on npm, it is a nice mapping to the ultimate authority, the domain. |
|
The emphasis being on "assumed", but stated as fact... -> The only other major platform not allowing dots is github. Gitea and GitLab don't have problem with dots. There is also no reason to not allow dots, since url paths allow dots as unreserved characters (see rfc 3986). https://www.npmjs.com/package/@push.rocks/smartdata |
|
@KnorpelSenf So... Have I convinced you and you throw your support behind this one? |
|
Sure, if npm allows it, then it would likely ease the migration if JSR did the same. That being said, it is still strange to me why anyone would want to do this in the first place (but that's my personal take and not a reason to block anything) |
|
@KnorpelSenf Cool :) Can you review the change? |
|
I have no power here, my review does not help you get this merged |



Updates validation rules to allow dots (.) in organization names while maintaining backward compatibility with existing names.
Backend changes:
Frontend changes:
Valid examples: my.org, foo.bar, foo.bar.baz, org.name-123
Invalid examples: .foo, foo., foo..bar
Reasoning
Allow Open Source projects to mirror their project domain as org name.
PR Checklist
conventional commits
description of the changes and rason behind them.
recording of the changes.
If it affect colors, please include screenshots/recording in both
light and dark mode.
And if changing dababase queries, be sure you have ran
sqlx prepareand committed the changes in the
.sqlxdirectory.