MarshalX / atproto

The AT Protocol (🦋 Bluesky) SDK for Python 🐍
https://atproto.blue
MIT License
309 stars 33 forks source link

'py_type' | '$type' is not fully backward and forward compatible #354

Open MarshalX opened 3 months ago

MarshalX commented 3 months ago

Need to investigate. We should fallback to DotDict class

Recent incident from get_author_feed method:

atproto_client.exceptions.ModelError: 1 validation error for Response
feed.0.post.embed.`app.bsky.embed.record#view`.record
  Input tag 'app.bsky.graph.defs#starterPackViewBasic' found using 'py_type' | '$type' does not match any of the expected tags: 'app.bsky.embed.record#viewRecord', 'app.bsky.embed.record#viewNotFound', 'app.bsky.embed.record#viewBlocked', 'app.bsky.feed.defs#generatorView', 'app.bsky.graph.defs#listView', 'app.bsky.labeler.defs#labelerView' [type=union_tag_invalid, input_value={'uri': 'at://did:plc:tcc...s#starterPackViewBasic'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.7/v/union_tag_invalid

could be reproduced using v0.0.48. v0.0.49 adds new union type

MarshalX commented 2 months ago

The same happened again. Again with embeds. On v0.0.49

Input tag 'app.bsky.embed.record#viewDetached' found using 'py_type' | '$type' does not match any of the expected tags