Skip to content

Conversation

sydney-runkle
Copy link
Contributor

Fix #10914

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Nov 21, 2024
Copy link

codspeed-hq bot commented Nov 21, 2024

CodSpeed Performance Report

Merging #10922 will not alter performance

Comparing urls-str-constraints (21b2401) with main (22a9af2)

Summary

✅ 46 untouched benchmarks

Copy link
Contributor

github-actions bot commented Nov 21, 2024

Coverage report

This PR does not seem to contain any modification to coverable code.

Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems correct with one simplification.

Copy link
Member

@Viicos Viicos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, hopefully we'll soon be able to rework this annotation application because the function-wrap check is quite unfortunate

@antazoey
Copy link

I used to be able to use FileURL for AnyUrl in my models (I have a field that can literally be AnyUrl, including file ones)... Should I make a separate issue or does this also fix that? Is there a way we can have a test for that use-case?

@sydney-runkle
Copy link
Contributor Author

Looks good, hopefully we'll soon be able to rework this annotation application because the function-wrap check is quite unfortunate

yes, very much so, I'd like to rework the url types more - I think we could still reconsider validation on init, or at least go about it in a different way

Copy link

cloudflare-workers-and-pages bot commented Nov 21, 2024

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 21b2401
Status: ✅  Deploy successful!
Preview URL: https://4e7b8150.pydantic-docs.pages.dev
Branch Preview URL: https://urls-str-constraints.pydantic-docs.pages.dev

View logs

@sydney-runkle
Copy link
Contributor Author

@antazoey,

The issue is that AnyUrl requires a host, whereas FileUrl does not. So perhaps you can get the desired result with AnyUrl | FileUrl as your type?

@sydney-runkle sydney-runkle enabled auto-merge (squash) November 21, 2024 17:43
@sydney-runkle sydney-runkle merged commit 73509ed into main Nov 21, 2024
52 checks passed
@sydney-runkle sydney-runkle deleted the urls-str-constraints branch November 21, 2024 17:48
@antazoey
Copy link

@antazoey,

The issue is that AnyUrl requires a host, whereas FileUrl does not. So perhaps you can get the desired result with AnyUrl | FileUrl as your type?

OK I can do that. Is host required now only on 2.10 or was it required before but just not failing validation?

sydney-runkle added a commit that referenced this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes-fix Used for bugfixes.

4 participants