# fyi.opensocial.defs

Shared definitions

Shared definitions the reference host at opensocial.fyi publishes. The page: https://www.atmospheregroups.org/reference/lexicons/fyi-opensocial-defs/

- Published at: at://did:plc:2gqnilpksz2e7faj3bwvo6qc/com.atproto.lexicon.schema/fyi.opensocial.defs
- In the spec: https://www.atmospheregroups.org/spec/lexicons/org-atgrp-defs/, which differs

## The schema as published

```json
{
  "defs": {
    "accessConfig": {
      "description": "Contents of an access record.",
      "properties": {
        "grants": {
          "items": {
            "ref": "#spaceGrant",
            "type": "ref"
          },
          "maxLength": 100,
          "type": "array"
        },
        "public": {
          "default": false,
          "type": "boolean"
        },
        "writableBy": {
          "description": "Who may write into the space in their own name, when not every member whose roles grant read: role ids, or 'public' for anyone signed in. Absent or empty is every such member.",
          "items": {
            "ref": "#audience",
            "type": "ref"
          },
          "maxLength": 50,
          "type": "array"
        }
      },
      "required": [
        "grants"
      ],
      "type": "object"
    },
    "accountRef": {
      "description": "An account, by its DID.",
      "properties": {
        "did": {
          "format": "did",
          "type": "string"
        }
      },
      "required": [
        "did"
      ],
      "type": "object"
    },
    "accountSubject": {
      "description": "An account, as a moderation subject.",
      "properties": {
        "did": {
          "format": "did",
          "type": "string"
        }
      },
      "required": [
        "did"
      ],
      "type": "object"
    },
    "action": {
      "description": "What a holder of a role may do, as the host's methods ask: each is answered by the scope that grants it in the role's grant.",
      "knownValues": [
        "mod.read",
        "mod.resolve",
        "label",
        "takedown",
        "invite",
        "admit",
        "eject",
        "role.assign",
        "space.create",
        "space.configure",
        "space.delete",
        "group.configure"
      ],
      "maxLength": 64,
      "type": "string"
    },
    "actorView": {
      "description": "A person, as a view names them: their DID, and the handle their DID document names, when it can be read.",
      "properties": {
        "canCreateGroup": {
          "description": "Only on the caller's own view, from getActor: whether this host lets them start a group (createGroup).",
          "type": "boolean"
        },
        "did": {
          "format": "did",
          "type": "string"
        },
        "handle": {
          "description": "The handle their DID document names; missing when it names none or cannot be read.",
          "format": "handle",
          "type": "string"
        }
      },
      "required": [
        "did"
      ],
      "type": "object"
    },
    "audience": {
      "description": "Who may read or write a space: a role, by its id, or everyone signed in.",
      "properties": {
        "role": {
          "description": "A role id, or public for anyone signed in.",
          "knownValues": [
            "public"
          ],
          "maxLength": 64,
          "type": "string"
        }
      },
      "required": [
        "role"
      ],
      "type": "object"
    },
    "collectionRef": {
      "description": "A collection of records, by its NSID, or * for any.",
      "properties": {
        "collection": {
          "maxLength": 317,
          "type": "string"
        }
      },
      "required": [
        "collection"
      ],
      "type": "object"
    },
    "ejectEvent": {
      "description": "The subject's membership was deleted.",
      "properties": {},
      "type": "object"
    },
    "groupGrant": {
      "description": "Scopes a role is granted across the group, and the roles its holders may assign.",
      "properties": {
        "assignable": {
          "description": "Roles holders may grant or revoke, and whose holders they may eject.",
          "items": {
            "ref": "fyi.opensocial.defs#roleId",
            "type": "ref"
          },
          "maxLength": 100,
          "type": "array"
        },
        "role": {
          "ref": "fyi.opensocial.defs#roleId",
          "type": "ref"
        },
        "scopes": {
          "description": "OAuth scopes, one per item. May include permission sets. `repo:` scopes are the public-repo collections holders may write as the group.",
          "items": {
            "maxLength": 2000,
            "minLength": 1,
            "type": "string"
          },
          "maxLength": 100,
          "type": "array"
        }
      },
      "required": [
        "role",
        "scopes",
        "assignable"
      ],
      "type": "object"
    },
    "groupRule": {
      "properties": {
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "rkey": {
          "format": "record-key",
          "type": "string"
        },
        "text": {
          "maxGraphemes": 2000,
          "maxLength": 20000,
          "type": "string"
        },
        "title": {
          "maxGraphemes": 100,
          "maxLength": 1000,
          "type": "string"
        }
      },
      "required": [
        "rkey",
        "title"
      ],
      "type": "object"
    },
    "groupView": {
      "description": "A group as a list shows it. To a caller not signed in, only its did and handle.",
      "properties": {
        "address": {
          "description": "The group's address here: one label under this host's handle domain, set when the group is made or arrives. Its handle, until the group takes one of its own.",
          "type": "string"
        },
        "avatar": {
          "description": "CID of the avatar blob; the host serves it at /img/{did}/{cid}, to whoever may see the profile.",
          "type": "string"
        },
        "banner": {
          "description": "CID of the banner blob; the host serves it at /img/{did}/{cid}, to whoever may see the profile.",
          "type": "string"
        },
        "createdAt": {
          "description": "When the group was started on this host.",
          "format": "datetime",
          "type": "string"
        },
        "deactivated": {
          "description": "Set while a steward has the group switched off. Its spaces cannot be read until one of the stewards who could switch it off switches it back on.",
          "type": "boolean"
        },
        "description": {
          "type": "string"
        },
        "did": {
          "format": "did",
          "type": "string"
        },
        "displayName": {
          "type": "string"
        },
        "handle": {
          "format": "handle",
          "type": "string"
        },
        "joinPolicy": {
          "description": "How new members get in, as the profile states it.",
          "type": "string"
        },
        "languages": {
          "description": "The languages it uses, as BCP 47 tags: en, pl, sl.",
          "items": {
            "ref": "#languageRef",
            "type": "ref"
          },
          "maxLength": 5,
          "type": "array"
        },
        "location": {
          "description": "Where it meets, if it meets somewhere: a town or city is enough.",
          "refs": [
            "community.lexicon.location.address",
            "community.lexicon.location.geo",
            "community.lexicon.location.fsq",
            "community.lexicon.location.hthree"
          ],
          "type": "union"
        },
        "members": {
          "format": "space-ref",
          "type": "string"
        },
        "meta": {
          "format": "space-ref",
          "type": "string"
        },
        "online": {
          "description": "It meets online, as well as or instead of somewhere.",
          "type": "boolean"
        },
        "rules": {
          "items": {
            "ref": "#groupRule",
            "type": "ref"
          },
          "type": "array"
        },
        "topics": {
          "description": "What it's about, a few words each, as the group puts it: climbing, choir, renters' union.",
          "items": {
            "ref": "#topicRef",
            "type": "ref"
          },
          "maxLength": 10,
          "type": "array"
        },
        "url": {
          "description": "The group's own site, if it keeps one.",
          "format": "uri",
          "type": "string"
        }
      },
      "required": [
        "did",
        "handle"
      ],
      "type": "object"
    },
    "groupViewBasic": {
      "properties": {
        "address": {
          "description": "The group's address here: one label under this host's handle domain, set when the group is made or arrives. Its handle, until the group takes one of its own.",
          "type": "string"
        },
        "avatar": {
          "description": "CID of the group's picture.",
          "type": "string"
        },
        "did": {
          "format": "did",
          "type": "string"
        },
        "displayName": {
          "type": "string"
        },
        "handle": {
          "format": "handle",
          "type": "string"
        },
        "memberCount": {
          "description": "How many people are in it. Only to its members.",
          "minimum": 0,
          "type": "integer"
        },
        "sampleMembers": {
          "description": "A few of its members, each as they are in the group, to show their faces. Only to its members.",
          "items": {
            "ref": "#actorView",
            "type": "ref"
          },
          "maxLength": 5,
          "type": "array"
        },
        "url": {
          "description": "The group's own site, if not at its handle.",
          "format": "uri",
          "type": "string"
        }
      },
      "required": [
        "did",
        "handle"
      ],
      "type": "object"
    },
    "groupViewDetailed": {
      "description": "A group in full, as the viewer may see it. Profile fields and rules are present only when the viewer may read the meta space.",
      "properties": {
        "address": {
          "description": "The group's address here: one label under this host's handle domain, set when the group is made or arrives. Its handle, until the group takes one of its own.",
          "type": "string"
        },
        "avatar": {
          "description": "CID of the avatar blob; the host serves it at /img/{did}/{cid}, to whoever may see the profile.",
          "type": "string"
        },
        "banner": {
          "description": "CID of the banner blob; the host serves it at /img/{did}/{cid}, to whoever may see the profile.",
          "type": "string"
        },
        "deactivated": {
          "description": "Set while a steward has the group switched off. Its spaces cannot be read until one of the stewards who could switch it off switches it back on.",
          "type": "boolean"
        },
        "description": {
          "type": "string"
        },
        "did": {
          "format": "did",
          "type": "string"
        },
        "displayName": {
          "type": "string"
        },
        "handle": {
          "format": "handle",
          "type": "string"
        },
        "joinPolicy": {
          "description": "How new members get in, as the profile states it.",
          "type": "string"
        },
        "languages": {
          "description": "The languages it uses, as BCP 47 tags: en, pl, sl.",
          "items": {
            "ref": "#languageRef",
            "type": "ref"
          },
          "maxLength": 5,
          "type": "array"
        },
        "links": {
          "description": "Where else the group is, as its profile lists them.",
          "items": {
            "ref": "#link",
            "type": "ref"
          },
          "maxLength": 5,
          "type": "array"
        },
        "location": {
          "description": "Where it meets, if it meets somewhere: a town or city is enough.",
          "refs": [
            "community.lexicon.location.address",
            "community.lexicon.location.geo",
            "community.lexicon.location.fsq",
            "community.lexicon.location.hthree"
          ],
          "type": "union"
        },
        "memberCount": {
          "description": "How many are in it. Present only when the viewer may read the members space, whose members listMembers gives a page at a time.",
          "minimum": 0,
          "type": "integer"
        },
        "members": {
          "format": "space-ref",
          "type": "string"
        },
        "meta": {
          "format": "space-ref",
          "type": "string"
        },
        "online": {
          "description": "It meets online, as well as or instead of somewhere.",
          "type": "boolean"
        },
        "rules": {
          "description": "In the order they are presented. Absent when the meta space is closed to the viewer.",
          "items": {
            "ref": "#groupRule",
            "type": "ref"
          },
          "type": "array"
        },
        "topics": {
          "description": "What it's about, a few words each, as the group puts it: climbing, choir, renters' union.",
          "items": {
            "ref": "#topicRef",
            "type": "ref"
          },
          "maxLength": 10,
          "type": "array"
        },
        "url": {
          "description": "The group's own site, if it keeps one.",
          "format": "uri",
          "type": "string"
        },
        "viewer": {
          "ref": "#viewerState",
          "type": "ref"
        }
      },
      "required": [
        "did",
        "handle"
      ],
      "type": "object"
    },
    "inviteView": {
      "properties": {
        "actor": {
          "description": "Whom it invites, with their handle where it can be read: on listInvites.",
          "ref": "#actorView",
          "type": "ref"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "expiresAt": {
          "format": "datetime",
          "type": "string"
        },
        "invitee": {
          "format": "did",
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "uri",
        "invitee",
        "createdAt"
      ],
      "type": "object"
    },
    "joinPolicy": {
      "description": "open admits anyone; approval queues a join request; invite requires an invitation. An invitation admits its recipient under any policy.",
      "knownValues": [
        "open",
        "approval",
        "invite"
      ],
      "type": "string"
    },
    "joinRequest": {
      "description": "A request to join, waiting in the host.",
      "properties": {
        "actor": {
          "description": "Who is asking, as a view names them.",
          "ref": "#actorView",
          "type": "ref"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "member": {
          "format": "did",
          "type": "string"
        },
        "message": {
          "maxGraphemes": 2000,
          "maxLength": 20000,
          "type": "string"
        }
      },
      "required": [
        "member",
        "createdAt"
      ],
      "type": "object"
    },
    "labelEvent": {
      "description": "A label record was written or deleted.",
      "properties": {
        "deleted": {
          "default": false,
          "type": "boolean"
        },
        "uri": {
          "description": "The label record.",
          "format": "at-uri",
          "type": "string"
        },
        "val": {
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "uri",
        "val"
      ],
      "type": "object"
    },
    "labelerPolicies": {
      "properties": {
        "labelValueDefinitions": {
          "description": "Its own label values, defined.",
          "items": {
            "ref": "com.atproto.label.defs#labelValueDefinition",
            "type": "ref"
          },
          "type": "array"
        },
        "labelValues": {
          "description": "The label values it applies.",
          "items": {
            "ref": "com.atproto.label.defs#labelValue",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "labelValues"
      ],
      "type": "object"
    },
    "languageRef": {
      "description": "A language the group uses.",
      "properties": {
        "language": {
          "format": "language",
          "type": "string"
        }
      },
      "required": [
        "language"
      ],
      "type": "object"
    },
    "link": {
      "description": "A place on the web where the group is: its site, a chat, a calendar.",
      "properties": {
        "title": {
          "description": "What it is, as the group puts it.",
          "maxGraphemes": 64,
          "maxLength": 640,
          "type": "string"
        },
        "url": {
          "description": "An http or https address.",
          "format": "uri",
          "maxLength": 2048,
          "type": "string"
        }
      },
      "required": [
        "url"
      ],
      "type": "object"
    },
    "memberView": {
      "properties": {
        "actor": {
          "ref": "#actorView",
          "type": "ref"
        },
        "roles": {
          "items": {
            "ref": "#roleRef",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "actor",
        "roles"
      ],
      "type": "object"
    },
    "moderationEvent": {
      "description": "One event in the host's private moderation history.",
      "properties": {
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "createdBy": {
          "description": "Hosts may withhold this to protect reporters and moderators.",
          "format": "did",
          "type": "string"
        },
        "event": {
          "refs": [
            "fyi.opensocial.defs#reportEvent",
            "fyi.opensocial.defs#statusEvent",
            "fyi.opensocial.defs#labelEvent",
            "fyi.opensocial.defs#ejectEvent"
          ],
          "type": "union"
        },
        "id": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "id",
        "createdAt",
        "event"
      ],
      "type": "object"
    },
    "recordSubject": {
      "description": "A record, as a moderation subject.",
      "properties": {
        "cid": {
          "description": "A specific version. Omit for the record as a whole.",
          "format": "cid",
          "type": "string"
        },
        "uri": {
          "description": "A record in one of the group's spaces.",
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "uri"
      ],
      "type": "object"
    },
    "reportEvent": {
      "description": "Someone reported the subject.",
      "properties": {
        "reason": {
          "maxGraphemes": 2000,
          "maxLength": 20000,
          "type": "string"
        },
        "reasonType": {
          "ref": "com.atproto.moderation.defs#reasonType",
          "type": "ref"
        },
        "rule": {
          "description": "A rule in the group's meta space.",
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "reasonType"
      ],
      "type": "object"
    },
    "roleBinding": {
      "description": "What one role may do, as the host reads its grant.",
      "properties": {
        "actions": {
          "items": {
            "ref": "#action",
            "type": "ref"
          },
          "type": "array"
        },
        "assignable": {
          "items": {
            "ref": "#roleRef",
            "type": "ref"
          },
          "type": "array"
        },
        "repoCollections": {
          "description": "The public-repo collections holders may write as the group; `*` for any.",
          "items": {
            "ref": "#collectionRef",
            "type": "ref"
          },
          "type": "array"
        },
        "role": {
          "maxLength": 64,
          "type": "string"
        },
        "scopes": {
          "description": "The role's grant as the permissions record has it.",
          "items": {
            "ref": "#scopeRef",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "role",
        "actions",
        "assignable"
      ],
      "type": "object"
    },
    "roleId": {
      "description": "The rkey of a role record in the group's members space.",
      "format": "record-key",
      "maxLength": 512,
      "type": "string"
    },
    "roleRef": {
      "description": "A role, by its id: the record key of a fyi.opensocial.role record.",
      "properties": {
        "role": {
          "maxLength": 64,
          "type": "string"
        }
      },
      "required": [
        "role"
      ],
      "type": "object"
    },
    "roleView": {
      "properties": {
        "bot": {
          "description": "People with this role are bots.",
          "type": "boolean"
        },
        "default": {
          "description": "Granted to members who join through requestJoin.",
          "type": "boolean"
        },
        "description": {
          "type": "string"
        },
        "key": {
          "description": "The role id: its record key.",
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "key"
      ],
      "type": "object"
    },
    "scopeRef": {
      "description": "An OAuth scope, as a permission or permission set is written.",
      "properties": {
        "scope": {
          "maxLength": 400,
          "type": "string"
        }
      },
      "required": [
        "scope"
      ],
      "type": "object"
    },
    "spaceGrant": {
      "description": "Scopes a role is granted in one space.",
      "properties": {
        "role": {
          "description": "A role id: the record key of a fyi.opensocial.role record.",
          "format": "record-key",
          "maxLength": 512,
          "type": "string"
        },
        "scopes": {
          "description": "OAuth scopes, one per item: space scopes, read against this space. One granting read lets the role read the space; one naming collections lets it write those as the group here.",
          "items": {
            "maxLength": 2000,
            "minLength": 1,
            "type": "string"
          },
          "maxLength": 100,
          "type": "array"
        }
      },
      "required": [
        "role",
        "scopes"
      ],
      "type": "object"
    },
    "spaceView": {
      "properties": {
        "grants": {
          "description": "The scopes each role is granted there, when the viewer may read the space.",
          "items": {
            "ref": "#spaceGrant",
            "type": "ref"
          },
          "type": "array"
        },
        "name": {
          "type": "string"
        },
        "people": {
          "description": "For chosen people: who they are, when the viewer is one of them. Only they read it or write in it.",
          "items": {
            "ref": "#accountRef",
            "type": "ref"
          },
          "type": "array"
        },
        "public": {
          "description": "Whether anyone signed in may read it, when the viewer may read the space.",
          "type": "boolean"
        },
        "spaceType": {
          "format": "nsid",
          "type": "string"
        },
        "uri": {
          "format": "space-ref",
          "type": "string"
        },
        "writableBy": {
          "description": "Who may write there in their own name, when the viewer may read the space. Absent is every member whose roles grant read.",
          "items": {
            "ref": "#audience",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "uri",
        "spaceType"
      ],
      "type": "object"
    },
    "statusEvent": {
      "description": "A moderator set the subject's status, optionally with a note.",
      "properties": {
        "note": {
          "maxGraphemes": 2000,
          "maxLength": 20000,
          "type": "string"
        },
        "status": {
          "ref": "fyi.opensocial.defs#subjectStatus",
          "type": "ref"
        }
      },
      "required": [
        "status"
      ],
      "type": "object"
    },
    "subjectStatus": {
      "description": "Where a subject stands in the moderation queue.",
      "enum": [
        "open",
        "escalated",
        "resolved"
      ],
      "type": "string"
    },
    "subjectView": {
      "properties": {
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "reportCount": {
          "minimum": 0,
          "type": "integer"
        },
        "status": {
          "ref": "fyi.opensocial.defs#subjectStatus",
          "type": "ref"
        },
        "subject": {
          "refs": [
            "fyi.opensocial.defs#accountSubject",
            "fyi.opensocial.defs#recordSubject"
          ],
          "type": "union"
        },
        "updatedAt": {
          "format": "datetime",
          "type": "string"
        }
      },
      "required": [
        "subject",
        "status",
        "createdAt",
        "updatedAt",
        "reportCount"
      ],
      "type": "object"
    },
    "topicRef": {
      "description": "A topic the group is about.",
      "properties": {
        "topic": {
          "maxGraphemes": 64,
          "maxLength": 640,
          "type": "string"
        }
      },
      "required": [
        "topic"
      ],
      "type": "object"
    },
    "viewerState": {
      "description": "The requesting account's standing in the group. Only present for authed requests.",
      "properties": {
        "accepted": {
          "description": "For a member: whether their own acceptance is in the members space.",
          "type": "boolean"
        },
        "actions": {
          "description": "The union of actions across the viewer's roles: what the host would let them do.",
          "items": {
            "ref": "fyi.opensocial.defs#action",
            "type": "ref"
          },
          "type": "array"
        },
        "member": {
          "type": "boolean"
        },
        "request": {
          "description": "The viewer's own pending request to join, when they are not a member and have one.",
          "ref": "#joinRequest",
          "type": "ref"
        },
        "roles": {
          "items": {
            "ref": "#roleRef",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "member",
        "roles",
        "actions"
      ],
      "type": "object"
    }
  },
  "id": "fyi.opensocial.defs",
  "lexicon": 1
}
```
