Skip to content

Serialize relative URLs explicitly - #20

Merged
ioquatix merged 1 commit into
mainfrom
explicit-relative-serialization
Aug 15, 2026
Merged

Serialize relative URLs explicitly#20
ioquatix merged 1 commit into
mainfrom
explicit-relative-serialization

Conversation

@samuel-williams-shopify

@samuel-williams-shopify samuel-williams-shopify commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move explicit: from relative path calculation to URL serialization
  • add to_s(explicit: true) and append(..., explicit: true) for relative URLs and references
  • preserve absolute, root-relative, and parent-relative serialization
  • remove explicit: from Path.relative and Relative#relative_to

There are two serialization contexts:

  1. A field known to contain a URL, where the RFC-minimal relative reference is sufficient.
  2. A mixed grammar where a string may be a URL or another kind of value, where the URL must be lexically self-identifying.

In the second context, explicit: true adds ./ to otherwise ambiguous same-directory references. Applying this at serialization preserves the distinction after URL composition and normalization.

This revises the API introduced in v0.17.0.

Testing

  • BUNDLE_WITHOUT=maintenance bundle exec bake test (390 tests, 571 assertions)
  • BUNDLE_WITHOUT=maintenance bundle exec rubocop

@samuel-williams-shopify
samuel-williams-shopify force-pushed the explicit-relative-serialization branch from 2e4b5f4 to 3a521dd Compare August 15, 2026 00:47
@ioquatix
ioquatix merged commit e740110 into main Aug 15, 2026
39 of 40 checks passed
@ioquatix
ioquatix deleted the explicit-relative-serialization branch August 15, 2026 00:53
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