Skip to content

Commit 54fcaa3

Browse files
committed
Add migration note
1 parent 157eeed commit 54fcaa3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/migration.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,19 @@ Affected types:
274274
- `UnsubscribeRequestParams.uri`
275275
- `ResourceUpdatedNotificationParams.uri`
276276

277-
The `ClientSession.read_resource()`, `subscribe_resource()`, and `unsubscribe_resource()` methods now accept both `str` and `AnyUrl` for backwards compatibility.
277+
The `Client` and `ClientSession` methods `read_resource()`, `subscribe_resource()`, and `unsubscribe_resource()` now only accept `str` for the `uri` parameter. If you were passing `AnyUrl` objects, convert them to strings:
278+
279+
```python
280+
# Before (v1)
281+
from pydantic import AnyUrl
282+
283+
await client.read_resource(AnyUrl("test://resource"))
284+
285+
# After (v2)
286+
await client.read_resource("test://resource")
287+
# Or if you have an AnyUrl from elsewhere:
288+
await client.read_resource(str(my_any_url))
289+
```
278290

279291
## Deprecations
280292

0 commit comments

Comments
 (0)