Skip to content

Commit

Permalink
lexicons: more string limits (#1994)
Browse files Browse the repository at this point in the history
* limit external embed strings sizes

* set a (very large) alt text length limit

The motivation is to have *some* size limit on every string in post
records, to maximize interoperation. For example, we currently have a
CBOR library rejecting some records because of too-long strings.

We don't want to limit the ability of folks to be very descriptive in
alt text, specifically, so chose what seems to be a very large limit. If
this is not large enough, based on feedback, we can bump it even higher.
As context this is the largest string length limit in all of our
lexicons.

* make thumbnail URL fields format=uri

This mostly results in checks against the string being empty, or
unlimited size.

* codegen: string limits

* add changeset for string format lex updates
  • Loading branch information
bnewbold authored Jan 2, 2024
1 parent 2860951 commit ad0d976
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-kids-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@atproto/api': patch
---

additional app.bsky.feed.post Lexicon string format limits
26 changes: 21 additions & 5 deletions lexicons/app/bsky/embed/external.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@
"required": ["uri", "title", "description"],
"properties": {
"uri": { "type": "string", "format": "uri" },
"title": { "type": "string" },
"description": { "type": "string" },
"title": {
"type": "string",
"maxGraphemes": 300,
"maxLength": 3000
},
"description": {
"type": "string",
"maxGraphemes": 1000,
"maxLength": 10000
},
"thumb": {
"type": "blob",
"accept": ["image/*"],
Expand All @@ -42,9 +50,17 @@
"required": ["uri", "title", "description"],
"properties": {
"uri": { "type": "string", "format": "uri" },
"title": { "type": "string" },
"description": { "type": "string" },
"thumb": { "type": "string" }
"title": {
"type": "string",
"maxGraphemes": 300,
"maxLength": 3000
},
"description": {
"type": "string",
"maxGraphemes": 1000,
"maxLength": 10000
},
"thumb": { "type": "string", "format": "uri" }
}
}
}
Expand Down
16 changes: 12 additions & 4 deletions lexicons/app/bsky/embed/images.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
"accept": ["image/*"],
"maxSize": 1000000
},
"alt": { "type": "string" },
"alt": {
"type": "string",
"maxGraphemes": 5000,
"maxLength": 50000
},
"aspectRatio": { "type": "ref", "ref": "#aspectRatio" }
}
},
Expand Down Expand Up @@ -51,9 +55,13 @@
"type": "object",
"required": ["thumb", "fullsize", "alt"],
"properties": {
"thumb": { "type": "string" },
"fullsize": { "type": "string" },
"alt": { "type": "string" },
"thumb": { "type": "string", "format": "uri" },
"fullsize": { "type": "string", "format": "uri" },
"alt": {
"type": "string",
"maxGraphemes": 5000,
"maxLength": 50000
},
"aspectRatio": { "type": "ref", "ref": "#aspectRatio" }
}
}
Expand Down
15 changes: 15 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4744,9 +4744,13 @@ export const schemaDict = {
},
title: {
type: 'string',
maxGraphemes: 300,
maxLength: 3000,
},
description: {
type: 'string',
maxGraphemes: 1000,
maxLength: 10000,
},
thumb: {
type: 'blob',
Expand Down Expand Up @@ -4775,12 +4779,17 @@ export const schemaDict = {
},
title: {
type: 'string',
maxGraphemes: 300,
maxLength: 3000,
},
description: {
type: 'string',
maxGraphemes: 1000,
maxLength: 10000,
},
thumb: {
type: 'string',
format: 'uri',
},
},
},
Expand Down Expand Up @@ -4816,6 +4825,8 @@ export const schemaDict = {
},
alt: {
type: 'string',
maxGraphemes: 5000,
maxLength: 50000,
},
aspectRatio: {
type: 'ref',
Expand Down Expand Up @@ -4859,12 +4870,16 @@ export const schemaDict = {
properties: {
thumb: {
type: 'string',
format: 'uri',
},
fullsize: {
type: 'string',
format: 'uri',
},
alt: {
type: 'string',
maxGraphemes: 5000,
maxLength: 50000,
},
aspectRatio: {
type: 'ref',
Expand Down
15 changes: 15 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4744,9 +4744,13 @@ export const schemaDict = {
},
title: {
type: 'string',
maxGraphemes: 300,
maxLength: 3000,
},
description: {
type: 'string',
maxGraphemes: 1000,
maxLength: 10000,
},
thumb: {
type: 'blob',
Expand Down Expand Up @@ -4775,12 +4779,17 @@ export const schemaDict = {
},
title: {
type: 'string',
maxGraphemes: 300,
maxLength: 3000,
},
description: {
type: 'string',
maxGraphemes: 1000,
maxLength: 10000,
},
thumb: {
type: 'string',
format: 'uri',
},
},
},
Expand Down Expand Up @@ -4816,6 +4825,8 @@ export const schemaDict = {
},
alt: {
type: 'string',
maxGraphemes: 5000,
maxLength: 50000,
},
aspectRatio: {
type: 'ref',
Expand Down Expand Up @@ -4859,12 +4870,16 @@ export const schemaDict = {
properties: {
thumb: {
type: 'string',
format: 'uri',
},
fullsize: {
type: 'string',
format: 'uri',
},
alt: {
type: 'string',
maxGraphemes: 5000,
maxLength: 50000,
},
aspectRatio: {
type: 'ref',
Expand Down
15 changes: 15 additions & 0 deletions packages/pds/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4744,9 +4744,13 @@ export const schemaDict = {
},
title: {
type: 'string',
maxGraphemes: 300,
maxLength: 3000,
},
description: {
type: 'string',
maxGraphemes: 1000,
maxLength: 10000,
},
thumb: {
type: 'blob',
Expand Down Expand Up @@ -4775,12 +4779,17 @@ export const schemaDict = {
},
title: {
type: 'string',
maxGraphemes: 300,
maxLength: 3000,
},
description: {
type: 'string',
maxGraphemes: 1000,
maxLength: 10000,
},
thumb: {
type: 'string',
format: 'uri',
},
},
},
Expand Down Expand Up @@ -4816,6 +4825,8 @@ export const schemaDict = {
},
alt: {
type: 'string',
maxGraphemes: 5000,
maxLength: 50000,
},
aspectRatio: {
type: 'ref',
Expand Down Expand Up @@ -4859,12 +4870,16 @@ export const schemaDict = {
properties: {
thumb: {
type: 'string',
format: 'uri',
},
fullsize: {
type: 'string',
format: 'uri',
},
alt: {
type: 'string',
maxGraphemes: 5000,
maxLength: 50000,
},
aspectRatio: {
type: 'ref',
Expand Down

0 comments on commit ad0d976

Please sign in to comment.