/lexicon

Introduction to Lexicon

Lexicon are the schema of ATProto, lexicon also have a schema, the lexicon for lexicon

  • very minimal, just a few core fields
    • lexicon (version), hardcoded 1 (for now), schema of all lexicon
    • id, NSID key
    • defs, the schema for records of this lexicon type (NSID)
  • two optional fields
    • description, should explain itself
    • revision, version for your lexicon

https://atproto.com/specs/lexicon

Lexicon Lexicon

{
  "lexicon": 1,
  "id": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "type": "record",
      "description": "Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc).",
      "key": "nsid",
      "record": {
        "type": "object",
        "required": ["lexicon"],
        "properties": {
          "lexicon": {
            "type": "integer",
            "description": "Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system."
          }
        }
      }
    }
  }
}

Like Lexicon

{
  "lexicon": 1,
  "id": "app.bsky.feed.like",
  "defs": {
    "main": {
      "type": "record",
      "description": "Record declaring a 'like' of a piece of subject content.",
      "key": "tid",
      "record": {
        "type": "object",
        "required": ["subject", "createdAt"],
        "properties": {
          "subject": { "type": "ref", "ref": "com.atproto.repo.strongRef" },
          "createdAt": { "type": "string", "format": "datetime" }
        }
      }
    }
  }
}

Like Record