Traits and behaviors #11
Replies: 3 comments 11 replies
-
Wouldn't traits have to be able to predict the exact field names that lexicons use? For example, if an events service used Also, unless I'm misunderstanding, why would you stipulate the specific |
Beta Was this translation helpful? Give feedback.
-
How would this be ingested from a firehose or a jetstream connection? Let's say smoke signal has some ingestor listening to smokesignal.* events from the firehose with |
Beta Was this translation helpful? Give feedback.
-
The description here talks about validating whether a record implements some trait, but imho it makes more sense to validate whether a lexicon implements some trait. From looking at a record alone, you can't infer the full type information of its fields (e.g. is something a string field that happens to contain an at:// URI, or is it actually typed as an at-uri string?), and so record-based trait checks can't be 100% certain. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
A while ago, there was a discussion about "traits" as a lexicon concept. A trait would define a number of fields and if a record had those fields, it was "implementing" that trait or behavior.
For example, if a record has the fields "name", "text", "startsAt", and "endsAt" then the "Event" trait is applicable.
Rationale
Traits can be a useful tool for determining how something can be treated within applications. For example, Smoke Signal, could consider any record that validates against the "Event" trait as something that could be viewed or RSVP'd to.
The same could apply to views. With the trait "FacetedView" including "createdAt", "text", and "facets", any record that matches the trait could be displayed within an app view. This would be a huge shift in how app views like bsky.app treat static types like posts as the only things that can be displayed.
Schema
A trait is a new lexicon "type" of "trait". Only objects have traits and traits only apply to objects.
A "trait" lexicon type has the following attributes:
Example Trait
Beta Was this translation helpful? Give feedback.
All reactions