Parakeet is a Rust-based Bluesky AppServer aiming to implement most of the functionality required to support the Bluesky client
appview atproto bluesky rust appserver
66
fork

Configure Feed

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

lexgen lexicon types

Mia a16243cb 927d2032

+227
+2
parakeet-lexgen/src/main.rs
··· 1 1 use clap::Parser; 2 2 use walkdir::WalkDir; 3 3 4 + mod types; 5 + 4 6 #[derive(Debug, Parser)] 5 7 struct Cli { 6 8 sources: Vec<String>,
+225
parakeet-lexgen/src/types.rs
··· 1 + use serde::Deserialize; 2 + use std::collections::BTreeMap; 3 + 4 + #[derive(Debug, Deserialize)] 5 + pub struct Lexicon { 6 + /// Lexicon language version 7 + pub lexicon: i32, 8 + // Lexicon NSID 9 + pub id: String, 10 + pub revision: Option<i32>, 11 + pub description: Option<String>, 12 + pub defs: BTreeMap<String, LexiconDef>, 13 + } 14 + 15 + #[derive(Debug, Deserialize)] 16 + #[serde(tag = "type")] 17 + #[serde(rename_all = "lowercase")] 18 + pub enum LexiconDef { 19 + Query(LexiconQuery), 20 + Procedure(LexiconProcedure), 21 + Subscription(LexiconSubscription), 22 + Record(LexiconRecord), 23 + String(LexiconString), 24 + Array(LexiconArray), 25 + Object(LexiconObject), 26 + Token { description: Option<String> }, 27 + } 28 + 29 + #[derive(Debug, Deserialize)] 30 + #[serde(tag = "type")] 31 + #[serde(rename_all = "kebab-case")] 32 + pub enum LexiconSchema { 33 + Null { 34 + description: Option<String>, 35 + }, 36 + Boolean { 37 + description: Option<String>, 38 + default: Option<bool>, 39 + #[serde(rename = "const")] 40 + constant: Option<bool>, 41 + }, 42 + Integer(LexiconInteger), 43 + String(LexiconString), 44 + Bytes { 45 + description: Option<String>, 46 + #[serde(rename = "maxLength")] 47 + max_length: Option<i32>, 48 + #[serde(rename = "minLength")] 49 + min_length: Option<i32>, 50 + }, 51 + CidLink { 52 + description: Option<String>, 53 + }, 54 + Array(LexiconArray), 55 + Object(LexiconObject), 56 + Blob { 57 + description: Option<String>, 58 + accept: Option<Vec<String>>, 59 + #[serde(rename = "maxSize")] 60 + max_size: Option<i32>, 61 + }, 62 + Ref { 63 + description: Option<String>, 64 + #[serde(rename = "ref")] 65 + ref_to: String, 66 + }, 67 + Union(LexiconUnion), 68 + Unknown { 69 + description: Option<String>, 70 + }, 71 + } 72 + 73 + #[derive(Debug, Deserialize)] 74 + #[serde(rename_all = "lowercase")] 75 + pub enum RKey { 76 + Tid, 77 + Nsid, 78 + Any, 79 + } 80 + 81 + #[derive(Debug, Deserialize)] 82 + #[serde(untagged)] 83 + pub enum RecordKey { 84 + Typed(RKey), 85 + Other(String), 86 + } 87 + 88 + #[derive(Debug, Deserialize)] 89 + #[serde(rename_all = "kebab-case")] 90 + pub enum StringFormats { 91 + AtIdentifier, 92 + AtUri, 93 + Cid, 94 + Datetime, 95 + Did, 96 + Handle, 97 + Nsid, 98 + Tid, 99 + RecordKey, 100 + Uri, 101 + Language, 102 + } 103 + 104 + #[derive(Debug, Deserialize)] 105 + pub struct HttpApiExchange { 106 + pub description: Option<String>, 107 + pub encoding: String, 108 + pub schema: Option<LexiconSchema>, 109 + } 110 + 111 + #[derive(Debug, Deserialize)] 112 + pub struct LexiconError { 113 + pub name: String, 114 + pub description: Option<String>, 115 + } 116 + 117 + #[derive(Debug, Deserialize)] 118 + pub struct LexiconSubMessage { 119 + pub description: Option<String>, 120 + pub schema: Option<LexiconUnion>, 121 + } 122 + 123 + #[derive(Debug, Deserialize)] 124 + pub struct LexiconRecord { 125 + pub description: Option<String>, 126 + pub key: RecordKey, 127 + pub record: LexiconObject, 128 + } 129 + 130 + #[derive(Debug, Deserialize)] 131 + pub struct LexiconQuery { 132 + pub description: Option<String>, 133 + pub parameters: Option<LexiconParams>, 134 + pub output: Option<HttpApiExchange>, 135 + pub errors: Option<Vec<LexiconError>>, 136 + } 137 + 138 + #[derive(Debug, Deserialize)] 139 + pub struct LexiconProcedure { 140 + pub description: Option<String>, 141 + pub parameters: Option<LexiconParams>, 142 + pub output: Option<HttpApiExchange>, 143 + pub input: Option<HttpApiExchange>, 144 + pub errors: Option<Vec<LexiconError>>, 145 + } 146 + 147 + #[derive(Debug, Deserialize)] 148 + pub struct LexiconSubscription { 149 + pub description: Option<String>, 150 + pub parameters: Option<LexiconParams>, 151 + pub message: BTreeMap<String, LexiconSubMessage>, 152 + pub errors: Option<Vec<LexiconError>>, 153 + } 154 + 155 + #[derive(Debug, Deserialize)] 156 + pub struct LexiconInteger { 157 + pub description: Option<String>, 158 + 159 + pub minimum: Option<i64>, 160 + pub maximum: Option<i64>, 161 + #[serde(rename = "enum")] 162 + pub values: Option<Vec<i64>>, 163 + pub default: Option<i64>, 164 + #[serde(rename = "const")] 165 + pub constant: Option<i64>, 166 + } 167 + 168 + #[derive(Debug, Deserialize)] 169 + #[serde(rename_all = "camelCase")] 170 + pub struct LexiconString { 171 + pub description: Option<String>, 172 + 173 + pub format: Option<StringFormats>, 174 + 175 + pub max_length: Option<i32>, 176 + pub min_length: Option<i32>, 177 + pub max_graphemes: Option<i32>, 178 + pub min_graphemes: Option<i32>, 179 + 180 + pub known_values: Option<Vec<String>>, 181 + #[serde(rename = "enum")] 182 + pub values: Option<Vec<String>>, 183 + 184 + pub default: Option<String>, 185 + #[serde(rename = "const")] 186 + pub constant: Option<String>, 187 + } 188 + 189 + #[derive(Debug, Deserialize)] 190 + #[serde(rename_all = "camelCase")] 191 + pub struct LexiconArray { 192 + pub description: Option<String>, 193 + 194 + pub min_length: Option<i32>, 195 + pub max_length: Option<i32>, 196 + pub items: Box<LexiconSchema>, 197 + } 198 + 199 + #[derive(Debug, Deserialize)] 200 + #[serde(tag = "type")] 201 + #[serde(rename = "object")] 202 + pub struct LexiconObject { 203 + pub description: Option<String>, 204 + pub properties: BTreeMap<String, LexiconSchema>, 205 + pub required: Option<Vec<String>>, 206 + pub nullable: Option<Vec<String>>, 207 + } 208 + 209 + #[derive(Debug, Deserialize)] 210 + #[serde(tag = "type")] 211 + #[serde(rename = "params")] 212 + pub struct LexiconParams { 213 + pub description: Option<String>, 214 + pub properties: BTreeMap<String, LexiconSchema>, 215 + } 216 + 217 + #[derive(Debug, Deserialize)] 218 + #[serde(tag = "type")] 219 + #[serde(rename = "union")] 220 + pub struct LexiconUnion { 221 + pub description: Option<String>, 222 + pub refs: Vec<String>, 223 + #[serde(default)] 224 + pub closed: bool, 225 + }