Barazo lexicon schemas and TypeScript types barazo.forum
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lexicons): bump tag limit from 5 to 25 (#40)

The original limit of 5 was conservative without a strong technical
reason. PDS record size is generous and tags are tiny strings. The UI
layer can control how many to display; the lexicon shouldn't be the
gatekeeper.

Community feedback: https://discourse.atprotocol.community/t/624/4

authored by

Guido X Jansen and committed by
GitHub
68f5907a f8fafdf8

+7 -7
+1 -1
lexicons/forum/barazo/topic/post.json
··· 43 43 }, 44 44 "tags": { 45 45 "type": "array", 46 - "maxLength": 5, 46 + "maxLength": 25, 47 47 "items": { 48 48 "type": "string", 49 49 "minLength": 1,
+1 -1
src/generated/lexicons.ts
··· 566 566 }, 567 567 tags: { 568 568 type: 'array', 569 - maxLength: 5, 569 + maxLength: 25, 570 570 items: { 571 571 type: 'string', 572 572 minLength: 1,
+1 -1
src/validation/topic-post.ts
··· 18 18 contentFormat: z.literal('markdown').optional(), 19 19 community: z.string().regex(didRegex), 20 20 category: z.string().regex(recordKeyRegex).max(640), 21 - tags: z.array(z.string().min(1).max(300)).max(5).optional(), 21 + tags: z.array(z.string().min(1).max(300)).max(25).optional(), 22 22 facets: z.array(facetSchema).optional(), 23 23 langs: z.array(z.string().min(1)).max(3).optional(), 24 24 labels: selfLabelsSchema.optional(),
+2 -2
tests/lexicon-schemas.test.ts
··· 118 118 expect(category['maxGraphemes']).toBe(64) 119 119 }) 120 120 121 - it('tags is optional with max 5 items', () => { 121 + it('tags is optional with max 25 items', () => { 122 122 const defs = schema['defs'] as Record<string, unknown> 123 123 const main = defs['main'] as Record<string, unknown> 124 124 const record = main['record'] as Record<string, unknown> ··· 126 126 expect(required).not.toContain('tags') 127 127 const props = record['properties'] as Record<string, unknown> 128 128 const tags = props['tags'] as Record<string, unknown> 129 - expect(tags['maxLength']).toBe(5) 129 + expect(tags['maxLength']).toBe(25) 130 130 }) 131 131 132 132 it('has optional facets array referencing app.bsky.richtext.facet', () => {
+2 -2
tests/zod-validation.test.ts
··· 67 67 expect(topicPostSchema.safeParse({ ...validPost, community: 'not-a-did' }).success).toBe(false) 68 68 }) 69 69 70 - it('rejects more than 5 tags', () => { 70 + it('rejects more than 25 tags', () => { 71 71 const tooManyTags = { 72 72 ...validPost, 73 - tags: ['a', 'b', 'c', 'd', 'e', 'f'], 73 + tags: Array.from({ length: 26 }, (_, i) => `tag-${String(i)}`), 74 74 } 75 75 expect(topicPostSchema.safeParse(tooManyTags).success).toBe(false) 76 76 })