A human-friendly DSL for ATProto Lexicons
27
fork

Configure Feed

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

Add test for avoiding def promotion and union ref resolution

authored by stavola.xyz and committed by

Tangled 94d286d0 8e1e3dcf

+118
+13
tests/codegen/lexicon/defs_no_main_promotion/input.mlf
··· 1 + /// A simple view of a user profile. 2 + def type profileView = { 3 + did!: Did, 4 + handle!: Handle, 5 + displayName: string, 6 + }; 7 + 8 + /// A detailed view with follower counts. 9 + def type profileViewDetailed = { 10 + did!: Did, 11 + handle!: Handle, 12 + followersCount: integer, 13 + };
+53
tests/codegen/lexicon/defs_no_main_promotion/lexicon@defs_no_main_promotion.snap
··· 1 + --- 2 + source: tests/codegen_integration.rs 3 + expression: output.json 4 + --- 5 + { 6 + "$type": "com.atproto.lexicon.schema", 7 + "lexicon": 1, 8 + "id": "com.example.actor.defs", 9 + "defs": { 10 + "profileView": { 11 + "type": "object", 12 + "description": "A simple view of a user profile.", 13 + "required": [ 14 + "did", 15 + "handle" 16 + ], 17 + "properties": { 18 + "did": { 19 + "type": "string", 20 + "format": "did" 21 + }, 22 + "handle": { 23 + "type": "string", 24 + "format": "handle" 25 + }, 26 + "displayName": { 27 + "type": "string" 28 + } 29 + } 30 + }, 31 + "profileViewDetailed": { 32 + "type": "object", 33 + "description": "A detailed view with follower counts.", 34 + "required": [ 35 + "did", 36 + "handle" 37 + ], 38 + "properties": { 39 + "did": { 40 + "type": "string", 41 + "format": "did" 42 + }, 43 + "handle": { 44 + "type": "string", 45 + "format": "handle" 46 + }, 47 + "followersCount": { 48 + "type": "integer" 49 + } 50 + } 51 + } 52 + } 53 + }
+4
tests/codegen/lexicon/defs_no_main_promotion/test.toml
··· 1 + [test] 2 + name = "defs_no_main_promotion" 3 + description = "In .defs namespaces, no def is promoted to main — even a sole def keeps its name" 4 + namespace = "com.example.actor.defs"
+5
tests/codegen/lexicon/defs_no_main_promotion/warnings@defs_no_main_promotion.snap
··· 1 + --- 2 + source: tests/codegen_integration.rs 3 + expression: formatted_warnings 4 + --- 5 + []
+26
tests/lexicon_to_mlf/union_refs_as_nsids/input.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.unionnsids", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "required": ["content"], 8 + "properties": { 9 + "content": { 10 + "type": "union", 11 + "refs": [ 12 + "#textBlock", 13 + "com.example.external#imageBlock" 14 + ] 15 + } 16 + } 17 + }, 18 + "textBlock": { 19 + "type": "object", 20 + "required": ["text"], 21 + "properties": { 22 + "text": { "type": "string" } 23 + } 24 + } 25 + } 26 + }
+12
tests/lexicon_to_mlf/union_refs_as_nsids/mlf@union_refs_as_nsids.snap
··· 1 + --- 2 + source: tests/lexicon_to_mlf_integration.rs 3 + expression: output.mlf 4 + --- 5 + @main 6 + def type unionnsids = { 7 + content!: textBlock | com.example.external.imageBlock, 8 + }; 9 + 10 + def type textBlock = { 11 + text!: string, 12 + };
+5
tests/lexicon_to_mlf/union_refs_as_nsids/warnings@union_refs_as_nsids.snap
··· 1 + --- 2 + source: tests/lexicon_to_mlf_integration.rs 3 + expression: formatted_warnings 4 + --- 5 + []