A community based topic aggregation platform built on atproto

feat(lexicon): Define atProto lexicon schemas for Communities

- social.coves.community.create - Procedure for creating communities
- social.coves.community.profile - Community profile record schema
- social.coves.community.update - Procedure for updating communities
- Add lexicon validation test data
- Follows atProto lexicon specification for federated records

Changed files
+82 -6
internal
atproto
lexicon
social
tests
lexicon-test-data
community
+16 -1
internal/atproto/lexicon/social/coves/community/create.json
···
"maximum": 10000,
"default": 100,
"description": "Reputation threshold required for membership"
}
}
}
···
"encoding": "application/json",
"schema": {
"type": "object",
-
"required": ["uri", "cid", "did"],
"properties": {
"uri": {
"type": "string",
···
"type": "string",
"format": "did",
"description": "DID of the created community"
}
}
}
···
"maximum": 10000,
"default": 100,
"description": "Reputation threshold required for membership"
+
},
+
"visibility": {
+
"type": "string",
+
"enum": ["public", "unlisted", "private"],
+
"default": "public",
+
"description": "Community visibility level"
+
},
+
"allowExternalDiscovery": {
+
"type": "boolean",
+
"default": true,
+
"description": "Whether other Coves instances can index and discover this community"
}
}
}
···
"encoding": "application/json",
"schema": {
"type": "object",
+
"required": ["uri", "cid", "did", "handle"],
"properties": {
"uri": {
"type": "string",
···
"type": "string",
"format": "did",
"description": "DID of the created community"
+
},
+
"handle": {
+
"type": "string",
+
"description": "Scoped handle of the created community (~name@instance)"
}
}
}
+46 -4
internal/atproto/lexicon/social/coves/community/profile.json
···
"key": "literal:self",
"record": {
"type": "object",
-
"required": ["name", "createdAt", "creator", "moderationType", "federatedFrom"],
"properties": {
"name": {
"type": "string",
"maxLength": 64,
-
"description": "Unique community name"
},
"displayName": {
"type": "string",
···
"accept": ["image/png", "image/jpeg", "image/webp"],
"maxSize": 2000000
},
-
"creator": {
"type": "string",
"format": "did",
-
"description": "DID of the community creator"
},
"moderationType": {
"type": "string",
···
"type": "string",
"format": "datetime"
}
}
}
}
···
"key": "literal:self",
"record": {
"type": "object",
+
"required": ["did", "handle", "name", "createdAt", "owner", "createdBy", "hostedBy", "visibility"],
"properties": {
+
"did": {
+
"type": "string",
+
"format": "did",
+
"description": "The community's unique DID identifier (portable across instances)"
+
},
+
"handle": {
+
"type": "string",
+
"maxLength": 253,
+
"description": "Scoped handle (~name@instance.com)"
+
},
"name": {
"type": "string",
"maxLength": 64,
+
"description": "Short community name (local part of handle)"
},
"displayName": {
"type": "string",
···
"accept": ["image/png", "image/jpeg", "image/webp"],
"maxSize": 2000000
},
+
"owner": {
+
"type": "string",
+
"format": "did",
+
"description": "DID of the community owner (instance DID in V1, community DID in V3)"
+
},
+
"createdBy": {
"type": "string",
"format": "did",
+
"description": "DID of the user who created this community"
+
},
+
"hostedBy": {
+
"type": "string",
+
"format": "did",
+
"description": "DID of the instance hosting this community"
+
},
+
"visibility": {
+
"type": "string",
+
"enum": ["public", "unlisted", "private"],
+
"default": "public",
+
"description": "Community visibility level"
+
},
+
"federation": {
+
"type": "ref",
+
"ref": "#federationConfig",
+
"description": "Federation and discovery configuration"
},
"moderationType": {
"type": "string",
···
"type": "string",
"format": "datetime"
}
+
}
+
}
+
},
+
"federationConfig": {
+
"type": "object",
+
"description": "Federation and discovery configuration for this community",
+
"properties": {
+
"allowExternalDiscovery": {
+
"type": "boolean",
+
"default": true,
+
"description": "Whether other Coves instances can index and discover this community"
}
}
}
+9
internal/atproto/lexicon/social/coves/community/update.json
···
"minimum": 0,
"maximum": 10000,
"description": "Reputation threshold required for membership"
}
}
}
···
"minimum": 0,
"maximum": 10000,
"description": "Reputation threshold required for membership"
+
},
+
"visibility": {
+
"type": "string",
+
"enum": ["public", "unlisted", "private"],
+
"description": "Community visibility level"
+
},
+
"allowExternalDiscovery": {
+
"type": "boolean",
+
"description": "Whether other Coves instances can index and discover this community"
}
}
}
+11 -1
tests/lexicon-test-data/community/profile-valid.json
···
{
"$type": "social.coves.community.profile",
"name": "programming",
"displayName": "Programming Community",
"description": "A community for programmers",
-
"creator": "did:plc:creator123456",
"moderationType": "moderator",
"federatedFrom": "coves",
"createdAt": "2023-12-01T08:00:00Z"
}
···
{
"$type": "social.coves.community.profile",
+
"did": "did:plc:community123456789abc",
+
"handle": "!programming@coves.social",
"name": "programming",
"displayName": "Programming Community",
"description": "A community for programmers",
+
"owner": "did:plc:instance123456",
+
"createdBy": "did:plc:creator123456",
+
"hostedBy": "did:plc:instance123456",
+
"visibility": "public",
+
"federation": {
+
"allowExternalDiscovery": true
+
},
"moderationType": "moderator",
+
"memberCount": 0,
+
"subscriberCount": 0,
"federatedFrom": "coves",
"createdAt": "2023-12-01T08:00:00Z"
}