Skip to content
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

schema-agnostic API helpers #869

Merged
merged 4 commits into from
Dec 17, 2024
Merged

schema-agnostic API helpers #869

merged 4 commits into from
Dec 17, 2024

Conversation

bnewbold
Copy link
Collaborator

@bnewbold bnewbold commented Dec 6, 2024

These are some variants of "typed" atproto sync/repo helpers from api/atproto which use json.RawMessage instead of the lexutil LexiconTypeDecoder wrapper.

These are mostly used from tools like goat which work with arbitrary record data, when we don't have lexgen types (or they aren't imported, or whatever). They can also be used for things like preferences, where the type in an open union is rapidly changing, and we don't want to "clobber" (drop) data from new lexicons the client code isn't familiar with.

You can see these in action: #870

@whyrusleeping you might want to do similar things in gosky.

Big picture we'll maybe want to move lexgen in this direction at some point? Relatedly, having LexiconTypeDecoder and open unions have an "unknown schema" option with raw data (possibly map[string]any instead of json.RawMessage; the later only makes sense for API endpoints, not record data).

Copy link
Contributor

@brianolson brianolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double check the comments on where things were copied from, a couple were bsky not atproto, otherwise makes sense

@@ -0,0 +1,28 @@
// Copied from indigo:api/atproto/actorgetPreferences.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api/bsky (in a few of these files)

@bnewbold bnewbold merged commit 7455486 into main Dec 17, 2024
7 of 8 checks passed
@bnewbold bnewbold deleted the bnewbold/api-agnostic branch December 17, 2024 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants