Skip to content

Commit

Permalink
Schema keyed hint (bluesky-social#243)
Browse files Browse the repository at this point in the history
* update schemas for keyed

* codegen dict

* codgen record ids

* determine key type from schema

* allow non-tid keys

* rm tids from batch write schema

* use schema ids record in db layouts

* standardize on rkey

* doc update

* crud test

* repo tests for custom rkeys
  • Loading branch information
dholms authored Oct 18, 2022
1 parent 0820013 commit fd18da2
Show file tree
Hide file tree
Showing 35 changed files with 348 additions and 189 deletions.
2 changes: 2 additions & 0 deletions docs/specs/lexicon.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface LexiconDoc {
}

interface RecordLexiconDoc extends LexiconDoc {
key?: string
record: JSONSchema
}

Expand Down Expand Up @@ -99,6 +100,7 @@ interface XrpcError {
"lexicon": 1,
"id": "todo.social.repost",
"type": "record",
"key": "tid",
"record": {
"type": "object",
"required": ["subject", "createdAt"],
Expand Down
9 changes: 5 additions & 4 deletions lexicons/atproto.com/repoBatchWrite.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,27 @@
"properties": {
"action": {"type": "string", "const": "create"},
"collection": {"type": "string"},
"rkey": {"type": "string"},
"value": {}
}
},
{
"type": "object",
"required": ["action", "collection", "tid", "value"],
"required": ["action", "collection", "rkey", "value"],
"properties": {
"action": {"type": "string", "const": "update"},
"collection": {"type": "string"},
"tid": {"type": "string"},
"rkey": {"type": "string"},
"value": {}
}
},
{
"type": "object",
"required": ["action", "collection", "tid"],
"required": ["action", "collection", "rkey"],
"properties": {
"action": {"type": "string", "const": "delete"},
"collection": {"type": "string"},
"tid": {"type": "string"}
"rkey": {"type": "string"}
}
}
]
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/badge.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "app.bsky.badge",
"type": "record",
"description": "An assertion about the subject by this user.",
"key": "tid",
"record": {
"type": "object",
"required": ["assertion", "createdAt"],
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/badgeAccept.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"lexicon": 1,
"id": "app.bsky.badgeAccept",
"type": "record",
"key": "tid",
"record": {
"type": "object",
"required": ["badge", "offer", "createdAt"],
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/badgeOffer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"lexicon": 1,
"id": "app.bsky.badgeOffer",
"type": "record",
"key": "tid",
"record": {
"type": "object",
"required": ["badge", "subject", "createdAt"],
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/follow.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "app.bsky.follow",
"type": "record",
"description": "A social follow",
"key": "tid",
"record": {
"type": "object",
"required": ["subject", "createdAt"],
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/like.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"lexicon": 1,
"id": "app.bsky.like",
"type": "record",
"key": "tid",
"record": {
"type": "object",
"required": ["subject", "createdAt"],
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/mediaEmbed.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "app.bsky.mediaEmbed",
"type": "record",
"description": "A list of media embedded in a post or document.",
"key": "tid",
"record": {
"type": "object",
"required": ["media"],
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/post.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"lexicon": 1,
"id": "app.bsky.post",
"type": "record",
"key": "tid",
"record": {
"type": "object",
"required": ["text", "createdAt"],
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"lexicon": 1,
"id": "app.bsky.profile",
"type": "record",
"key": "literal:self",
"record": {
"type": "object",
"required": ["displayName"],
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/repost.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"lexicon": 1,
"id": "app.bsky.repost",
"type": "record",
"key": "tid",
"record": {
"type": "object",
"required": ["subject", "createdAt"],
Expand Down
Loading

0 comments on commit fd18da2

Please sign in to comment.