Skip to content

Conversation

@Drowze
Copy link

@Drowze Drowze commented Oct 15, 2025

What does this PR do?

Adds the possibility to configure the underlying uri parser used by global_id gem.

For context:

Since URI v1.0.0, the URI::DEFAULT_PARSER is RFC3986_Parser (original PR, v1.0.0 release which included it). One notable change of the new default parser is that URIs with underscores in the host part are now considered valid (e.g.: foo://foo_bar)

On the other hand, since v1.3.0 GlobalID started hardcoding its underlying URI parser to RFC2396_Parser (i.e.: how URI::DEFAULT_PARSER was before uri v1 release), in what I suppose to be an effort to keep good compatibility.

Also relevant: URI v1 was released in Nov/2024, while GlobalID v1.3.0 was released almost an year later on Sep/2025.

Why?

Hardcoding the parser to RFC2396 on v1.3.0 was a breaking change for us: we started using GlobalID earlier this year and some of our URIs include underscore characters.
Unfortunately it's also not something we can easily change now: some of those now-invalid URIs were included in QR codes which were physically printed and distributed to some of our customers.


related issue(s): #201

@rafaelfranca
Copy link
Member

rafaelfranca commented Oct 22, 2025

Thank you for the pull request. It is unfortunate that underscore were allowed for so long depending on the URI parser, but it was never the intention. Allowing changing the parser just to allow underscore isn't something I think the library should do.

We might want to make a change to allow underscore in global id. I'd be ok with that. But I don't think it should be a configuration. Can you change the PR in that direction?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants