Skip to content

Commit

Permalink
Finalize lexicon reference behaviors, adding lex: URI references (blu…
Browse files Browse the repository at this point in the history
…esky-social#236)

* Update lexicon doc format to support .defs field and .descriptions within method bodies

* Add correct  resolution to lexicon, including to lex: URIs

* Update lexicons and generated code to use new  resolution
  • Loading branch information
pfrazee authored Oct 13, 2022
1 parent 7a9d773 commit 90b3792
Show file tree
Hide file tree
Showing 48 changed files with 2,636 additions and 766 deletions.
70 changes: 35 additions & 35 deletions lexicons/bsky.app/badge.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,46 @@
"properties": {
"assertion": {
"oneOf": [
{"$ref": "#/$defs/inviteAssertion"},
{"$ref": "#/$defs/employeeAssertion"},
{"$ref": "#/$defs/tagAssertion"},
{"$ref": "#/$defs/unknownAssertion"}
{"$ref": "#/defs/inviteAssertion"},
{"$ref": "#/defs/employeeAssertion"},
{"$ref": "#/defs/tagAssertion"},
{"$ref": "#/defs/unknownAssertion"}
]
},
"subject": { "type": "string" },
"createdAt": {"type": "string", "format": "date-time"}
}
},
"defs": {
"inviteAssertion": {
"type": "object",
"required": ["type"],
"properties": {
"type": {"const": "invite"}
}
},
"$defs": {
"inviteAssertion": {
"type": "object",
"required": ["type"],
"properties": {
"type": {"const": "invite"}
}
},
"employeeAssertion": {
"type": "object",
"required": ["type"],
"properties": {
"type": {"const": "employee"}
}
},
"tagAssertion": {
"type": "object",
"required": ["type", "tag"],
"properties": {
"type": {"const": "tag"},
"tag": {"type": "string", "maxLength": 64}
}
},
"unknownAssertion": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"not": {"enum": ["invite", "employee", "tag"]}
}
"employeeAssertion": {
"type": "object",
"required": ["type"],
"properties": {
"type": {"const": "employee"}
}
},
"tagAssertion": {
"type": "object",
"required": ["type", "tag"],
"properties": {
"type": {"const": "tag"},
"tag": {"type": "string", "maxLength": 64}
}
},
"unknownAssertion": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"not": {"enum": ["invite", "employee", "tag"]}
}
}
}
Expand Down
140 changes: 70 additions & 70 deletions lexicons/bsky.app/getAuthorFeed.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,83 +16,83 @@
"properties": {
"feed": {
"type": "array",
"items": {"$ref": "#/$defs/feedItem"}
"items": {"$ref": "#/defs/feedItem"}
}
},
"$defs": {
"feedItem": {
"type": "object",
"required": ["cursor", "uri", "cid", "author", "record", "replyCount", "repostCount", "likeCount", "indexedAt"],
"properties": {
"cursor": {"type": "string"},
"uri": {"type": "string"},
"cid": {"type": "string"},
"author": {"$ref": "#/$defs/user"},
"repostedBy": {"$ref": "#/$defs/user"},
"record": {"type": "object"},
"embed": {
"oneOf": [
{"$ref": "#/$defs/recordEmbed"},
{"$ref": "#/$defs/externalEmbed"},
{"$ref": "#/$defs/unknownEmbed"}
]
},
"replyCount": {"type": "number"},
"repostCount": {"type": "number"},
"likeCount": {"type": "number"},
"indexedAt": {"type": "string", "format": "date-time"},
"myState": {
"type": "object",
"properties": {
"repost": {"type": "string"},
"like": {"type": "string"}
}
}
}
},
"user": {
"type": "object",
"required": ["did", "name"],
"properties": {
"did": {"type": "string"},
"name": {"type": "string"},
"displayName": {
"type": "string",
"maxLength": 64
}
}
},
"recordEmbed": {
"type": "object",
"required": ["type", "author", "record"],
"properties": {
"type": {"const": "record"},
"author": {"$ref": "#/$defs/user"},
"record": {"type": "object"}
}
},
"externalEmbed": {
"type": "object",
"required": ["type", "uri", "title", "description", "imageUri"],
"properties": {
"type": {"const": "external"},
"uri": {"type": "string"},
"title": {"type": "string"},
"description": {"type": "string"},
"imageUri": {"type": "string"}
}
}
}
},
"defs": {
"feedItem": {
"type": "object",
"required": ["cursor", "uri", "cid", "author", "record", "replyCount", "repostCount", "likeCount", "indexedAt"],
"properties": {
"cursor": {"type": "string"},
"uri": {"type": "string"},
"cid": {"type": "string"},
"author": {"$ref": "#/defs/user"},
"repostedBy": {"$ref": "#/defs/user"},
"record": {"type": "object"},
"embed": {
"oneOf": [
{"$ref": "#/defs/recordEmbed"},
{"$ref": "#/defs/externalEmbed"},
{"$ref": "#/defs/unknownEmbed"}
]
},
"unknownEmbed": {
"replyCount": {"type": "number"},
"repostCount": {"type": "number"},
"likeCount": {"type": "number"},
"indexedAt": {"type": "string", "format": "date-time"},
"myState": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"not": {"enum": ["record", "external"]}
}
"repost": {"type": "string"},
"like": {"type": "string"}
}
}
}
},
"user": {
"type": "object",
"required": ["did", "name"],
"properties": {
"did": {"type": "string"},
"name": {"type": "string"},
"displayName": {
"type": "string",
"maxLength": 64
}
}
},
"recordEmbed": {
"type": "object",
"required": ["type", "author", "record"],
"properties": {
"type": {"const": "record"},
"author": {"$ref": "#/defs/user"},
"record": {"type": "object"}
}
},
"externalEmbed": {
"type": "object",
"required": ["type", "uri", "title", "description", "imageUri"],
"properties": {
"type": {"const": "external"},
"uri": {"type": "string"},
"title": {"type": "string"},
"description": {"type": "string"},
"imageUri": {"type": "string"}
}
},
"unknownEmbed": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"not": {"enum": ["record", "external"]}
}
}
}
}
}
140 changes: 70 additions & 70 deletions lexicons/bsky.app/getHomeFeed.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,83 +16,83 @@
"properties": {
"feed": {
"type": "array",
"items": {"$ref": "#/$defs/feedItem"}
"items": {"$ref": "#/defs/feedItem"}
}
},
"$defs": {
"feedItem": {
"type": "object",
"required": ["cursor", "uri", "cid", "author", "record", "replyCount", "repostCount", "likeCount", "indexedAt"],
"properties": {
"cursor": {"type": "string"},
"uri": {"type": "string"},
"cid": {"type": "string"},
"author": {"$ref": "#/$defs/user"},
"repostedBy": {"$ref": "#/$defs/user"},
"record": {"type": "object"},
"embed": {
"oneOf": [
{"$ref": "#/$defs/recordEmbed"},
{"$ref": "#/$defs/externalEmbed"},
{"$ref": "#/$defs/unknownEmbed"}
]
},
"replyCount": {"type": "number"},
"repostCount": {"type": "number"},
"likeCount": {"type": "number"},
"indexedAt": {"type": "string", "format": "date-time"},
"myState": {
"type": "object",
"properties": {
"repost": {"type": "string"},
"like": {"type": "string"}
}
}
}
},
"user": {
"type": "object",
"required": ["did", "name"],
"properties": {
"did": {"type": "string"},
"name": {"type": "string"},
"displayName": {
"type": "string",
"maxLength": 64
}
}
},
"recordEmbed": {
"type": "object",
"required": ["type", "author", "record"],
"properties": {
"type": {"const": "record"},
"author": {"$ref": "#/$defs/user"},
"record": {"type": "object"}
}
},
"externalEmbed": {
"type": "object",
"required": ["type", "uri", "title", "description", "imageUri"],
"properties": {
"type": {"const": "external"},
"uri": {"type": "string"},
"title": {"type": "string"},
"description": {"type": "string"},
"imageUri": {"type": "string"}
}
}
}
},
"defs": {
"feedItem": {
"type": "object",
"required": ["cursor", "uri", "cid", "author", "record", "replyCount", "repostCount", "likeCount", "indexedAt"],
"properties": {
"cursor": {"type": "string"},
"uri": {"type": "string"},
"cid": {"type": "string"},
"author": {"$ref": "#/defs/user"},
"repostedBy": {"$ref": "#/defs/user"},
"record": {"type": "object"},
"embed": {
"oneOf": [
{"$ref": "#/defs/recordEmbed"},
{"$ref": "#/defs/externalEmbed"},
{"$ref": "#/defs/unknownEmbed"}
]
},
"unknownEmbed": {
"replyCount": {"type": "number"},
"repostCount": {"type": "number"},
"likeCount": {"type": "number"},
"indexedAt": {"type": "string", "format": "date-time"},
"myState": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"not": {"enum": ["record", "external"]}
}
"repost": {"type": "string"},
"like": {"type": "string"}
}
}
}
},
"user": {
"type": "object",
"required": ["did", "name"],
"properties": {
"did": {"type": "string"},
"name": {"type": "string"},
"displayName": {
"type": "string",
"maxLength": 64
}
}
},
"recordEmbed": {
"type": "object",
"required": ["type", "author", "record"],
"properties": {
"type": {"const": "record"},
"author": {"$ref": "#/defs/user"},
"record": {"type": "object"}
}
},
"externalEmbed": {
"type": "object",
"required": ["type", "uri", "title", "description", "imageUri"],
"properties": {
"type": {"const": "external"},
"uri": {"type": "string"},
"title": {"type": "string"},
"description": {"type": "string"},
"imageUri": {"type": "string"}
}
},
"unknownEmbed": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"not": {"enum": ["record", "external"]}
}
}
}
}
}
Loading

0 comments on commit 90b3792

Please sign in to comment.