Skip to content

Conversation

davidhewitt
Copy link
Contributor

Change Summary

Reading through the logic for URL validation ahead of implementing my shot at #1719, I wanted to clean up a couple things:

  • Seemed always better to check for URL types before attempting to extract strings
  • Some conflation of "scheme" and "schema", which I wanted to clean up for my own sanity
  • I added some test cases to demonstrate that the trailing slash is only added to an "empty" path.

Related issue number

N/A

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Copy link

codspeed-hq bot commented Sep 16, 2025

CodSpeed Performance Report

Merging #1788 will not alter performance

Comparing dh/tidy-url-validation (79dfad7) with main (1cd5ee3)

Summary

✅ 161 untouched
🆕 2 new

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 test_multi_host_url_core N/A 33.5 µs N/A
🆕 test_url_core N/A 25 µs N/A

@davidhewitt
Copy link
Contributor Author

Will merge as a trivial clean-up

@davidhewitt davidhewitt merged commit cbe2dd2 into main Sep 16, 2025
31 checks passed
@davidhewitt davidhewitt deleted the dh/tidy-url-validation branch September 16, 2025 17:56
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.

1 participant