-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IpldLink model validation fails #338
Comments
Hi! Could you please provide the plain JSON needed to add unit tests for this case? It seems that ‘model_config’ was probably just forgotten in this model |
Here or in the pull-request? Without aliases it's basically: {"link":"bafkreia4linnhpphw5fughdn3wok7okklggww34txua76r6kbphuf3vsia"} I found out another thing. Probably, ref in BlobRef shouldn't be embed = models.AppBskyEmbedExternal.Main(
external=models.AppBskyEmbedExternal.External(
description="Yet another The Room gif",
title="oh hi mark",
uri="https://giphy.com/gifs/theroom-the-room-26CaLWA2dcqz6hS4U",
thumb=BlobRef(
mime_type="image/jpeg",
size=316179,
ref="bafkreia4linnhpphw5fughdn3wok7okklggww34txua76r6kbphuf3vsia",
)
)
)
record = client.send_post(
text="https://giphy.com/gifs/theroom-the-room-26CaLWA2dcqz6hS4U",
embed=embed,
) Exception:
|
Well, the ref could be in raw and in JSON formats. Also, there is a deprecated blob type and a new one. this class tries to support everything in one https://atproto.com/specs/data-model#blob-type
|
that's strange because we have test for it: atproto/tests/test_atproto_client/models/tests/test_blob_ref.py Lines 20 to 31 in d32f836
and atproto/tests/test_atproto_client/models/tests/test_blob_ref.py Lines 6 to 17 in d32f836
btw $ is required |
@dananev It is a sporadic case when you want to create a So instead of thumb = BlobRef(
mime_type='text/plain',
size=0,
ref='blabla',
) you need to do thumb = BlobRef(
mime_type='text/plain',
size=0,
ref=IpldLink(link='blabla'),
) I fixed this kind of creation in the linked PR. Probably it could be a good idea to have methods in I still can't reproduce the initial issue :( Probably you just missed |
@dananev please try to create To install SDK from the main branch: pip uninstall atproto
pip install git+https://github.com/MarshalX/atproto.git@main |
All good now, thank you for the quick fix! |
Hi! Thanks for the SDK!
I was working with it and got a tiny issue. When you try to instantiate
IpldLink
withlink
field validation fails:To fix the issue either
link
should be declared withserialization_alias
instead of plainalias
or we should addmodel_config
toIpldLink
.I can raise a small pull-request to fix the issue.
Thanks!
The text was updated successfully, but these errors were encountered: