A human-friendly DSL for ATProto Lexicons
1

Configure Feed

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

Add description of type definitions

If a type definition has a doc domment, it wasn't included as description
of that type.

Example:

```
/// A forum thread
record thread {
title!: title,
}

/// Thread title
def type title = string constrained {
maxLength: 200,
minLength: 1,
};
```

Would lead to just

```json
"title": {
"type": "string",
"maxLength": 200,
"minLength": 1
}
```

With this commit it contains the `Thread title` as description:

```
"title": {
"type": "string",
"description": "Thread title",
"maxLength": 200,
"minLength": 1
}

authored by

Volker Mische and committed by
Tangled
(Apr 14, 2026, 1:05 PM +0300) 045c7aaf 0e41523e

+52 -1
+8 -1
mlf-codegen/src/lib.rs
··· 586 586 } 587 587 588 588 fn generate_def_type_json(def_type: &DefType, usage_counts: &HashMap<String, usize>, workspace: &Workspace, current_namespace: &str) -> Value { 589 - generate_type_json(&def_type.ty, usage_counts, workspace, current_namespace) 589 + let mut field_json = generate_type_json(&def_type.ty, usage_counts, workspace, current_namespace); 590 + // Add description if the type definition has doc comments 591 + if !def_type.docs.is_empty() { 592 + if let Some(obj) = field_json.as_object_mut() { 593 + obj.shift_insert(1, "description".to_string(), json!(extract_docs(&def_type.docs))); 594 + } 595 + } 596 + field_json 590 597 } 591 598 592 599 fn generate_type_json(ty: &Type, usage_counts: &HashMap<String, usize>, workspace: &Workspace, current_namespace: &str) -> Value {
+30
tests/codegen/lexicon/doc_comments/expected.json
··· 1 + { 2 + "$type": "com.atproto.lexicon.schema", 3 + "lexicon": 1, 4 + "id": "com.example.thread", 5 + "defs": { 6 + "main": { 7 + "type": "record", 8 + "description": "A forum thread", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": [ 13 + "title" 14 + ], 15 + "properties": { 16 + "title": { 17 + "type": "ref", 18 + "ref": "#title" 19 + } 20 + } 21 + } 22 + }, 23 + "title": { 24 + "type": "string", 25 + "description": "Thread title", 26 + "maxLength": 200, 27 + "minLength": 1 28 + } 29 + } 30 + }
+10
tests/codegen/lexicon/doc_comments/input.mlf
··· 1 + /// A forum thread 2 + record thread { 3 + title!: title, 4 + } 5 + 6 + /// Thread title 7 + def type title = string constrained { 8 + maxLength: 200, 9 + minLength: 1, 10 + };
+4
tests/codegen/lexicon/doc_comments/test.toml
··· 1 + [test] 2 + name = "doc_comments" 3 + description = "Test doc comments for defs" 4 + namespace = "com.example.thread"