-
Notifications
You must be signed in to change notification settings - Fork 554
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
Record references in lexicon typed as unknown #999
Comments
I agree that it would be convenient to have concrete types for records embedded in responses like this. The issues we run into here are that a. technically users have the ability to publish invalid records in their repository, and b. there's the possibility that the schema for a record (for example) expands over time. It should do this in such a way that it remains both forward- and backward-compatible, but there are still lots of difficult cases that can arise or the schema author may not perfectly follow that rule. So programs ingesting raw record data should make sure they understand the semantics of the records that they're consuming when choosing how to deal with them. The way we typically handle this is by validating the record contents based on our application's version of the schema for the record. At that point the application can start to use a more specific type that it's prepared to handle, or decide to use some fallback behavior if it doesn't understand the record data it received. |
I don't think that's a problem, more of a consideration that should be kept in mind when implementing deserializers.
I see that, without record schema versioning it sounds impossible. I think It could be solved either by:
In summary, the issue can't be easily solved and all of the solutions I could think of have some drawbacks. Now I have one more question, what is the meaning of |
Yeah |
This is not correct. If the semantics that the library is aiming for is "any object" then |
hey @tom-sherman, it may not have come across clearly, but what @devinivy was saying was that However, you're correct in your comment here that I believe we're generated the wrong type there by generating |
important to note that an |
Yeah sorry about that, I think I got a little mixed up between those two threads! unknown maybe can be best represented as |
yup that sounds accurate 👍 |
@dholms wrote:
This does match the specification for
This does not match my reading of the specification for
as well as the specification for when to use
If it is the intention that If instead the The reason I came across this is that I've found at least one Lexicon that violates @dholms's assertion: |
Unfortunately this is still an soft spot and under-specified. We have a tracking issue here: bluesky-social/atproto-website#319 which references a discussion where other questions come up: #2615 The current "vibes" (not a spec!) are:
Something like a DID document, or fragment of a DID document, is basically exactly why we have Maybe we should add an additional lexicon type for arbitrary record! which would have to be an object and would need to have |
According to feed/defs.json post view's record type is
unknown
. But the API calls which return post view, have the record$type
set toapp.bsky.feed.post
.Is this intentional or am I missing something about the implementation?
Couldn't
postView#record
be typed as{ type: "recordRef", schema: "app.bsky.feed.post" }
?Edit:
Just to add, having them typed would allow for better codegen
The text was updated successfully, but these errors were encountered: