diff --git a/tests/codegen/lexicon/defs_no_main_promotion/input.mlf b/tests/codegen/lexicon/defs_no_main_promotion/input.mlf new file mode 100644 index 0000000..d9427b2 --- /dev/null +++ b/tests/codegen/lexicon/defs_no_main_promotion/input.mlf @@ -0,0 +1,13 @@ +/// A simple view of a user profile. +def type profileView = { + did!: Did, + handle!: Handle, + displayName: string, +}; + +/// A detailed view with follower counts. +def type profileViewDetailed = { + did!: Did, + handle!: Handle, + followersCount: integer, +}; diff --git a/tests/codegen/lexicon/defs_no_main_promotion/lexicon@defs_no_main_promotion.snap b/tests/codegen/lexicon/defs_no_main_promotion/lexicon@defs_no_main_promotion.snap new file mode 100644 index 0000000..a030f36 --- /dev/null +++ b/tests/codegen/lexicon/defs_no_main_promotion/lexicon@defs_no_main_promotion.snap @@ -0,0 +1,53 @@ +--- +source: tests/codegen_integration.rs +expression: output.json +--- +{ + "$type": "com.atproto.lexicon.schema", + "lexicon": 1, + "id": "com.example.actor.defs", + "defs": { + "profileView": { + "type": "object", + "description": "A simple view of a user profile.", + "required": [ + "did", + "handle" + ], + "properties": { + "did": { + "type": "string", + "format": "did" + }, + "handle": { + "type": "string", + "format": "handle" + }, + "displayName": { + "type": "string" + } + } + }, + "profileViewDetailed": { + "type": "object", + "description": "A detailed view with follower counts.", + "required": [ + "did", + "handle" + ], + "properties": { + "did": { + "type": "string", + "format": "did" + }, + "handle": { + "type": "string", + "format": "handle" + }, + "followersCount": { + "type": "integer" + } + } + } + } +} diff --git a/tests/codegen/lexicon/defs_no_main_promotion/test.toml b/tests/codegen/lexicon/defs_no_main_promotion/test.toml new file mode 100644 index 0000000..7eca0d6 --- /dev/null +++ b/tests/codegen/lexicon/defs_no_main_promotion/test.toml @@ -0,0 +1,4 @@ +[test] +name = "defs_no_main_promotion" +description = "In .defs namespaces, no def is promoted to main — even a sole def keeps its name" +namespace = "com.example.actor.defs" diff --git a/tests/codegen/lexicon/defs_no_main_promotion/warnings@defs_no_main_promotion.snap b/tests/codegen/lexicon/defs_no_main_promotion/warnings@defs_no_main_promotion.snap new file mode 100644 index 0000000..23a5161 --- /dev/null +++ b/tests/codegen/lexicon/defs_no_main_promotion/warnings@defs_no_main_promotion.snap @@ -0,0 +1,5 @@ +--- +source: tests/codegen_integration.rs +expression: formatted_warnings +--- +[] diff --git a/tests/lexicon_to_mlf/union_refs_as_nsids/input.json b/tests/lexicon_to_mlf/union_refs_as_nsids/input.json new file mode 100644 index 0000000..8dd8a95 --- /dev/null +++ b/tests/lexicon_to_mlf/union_refs_as_nsids/input.json @@ -0,0 +1,26 @@ +{ + "lexicon": 1, + "id": "com.example.unionnsids", + "defs": { + "main": { + "type": "object", + "required": ["content"], + "properties": { + "content": { + "type": "union", + "refs": [ + "#textBlock", + "com.example.external#imageBlock" + ] + } + } + }, + "textBlock": { + "type": "object", + "required": ["text"], + "properties": { + "text": { "type": "string" } + } + } + } +} diff --git a/tests/lexicon_to_mlf/union_refs_as_nsids/mlf@union_refs_as_nsids.snap b/tests/lexicon_to_mlf/union_refs_as_nsids/mlf@union_refs_as_nsids.snap new file mode 100644 index 0000000..4e94aae --- /dev/null +++ b/tests/lexicon_to_mlf/union_refs_as_nsids/mlf@union_refs_as_nsids.snap @@ -0,0 +1,12 @@ +--- +source: tests/lexicon_to_mlf_integration.rs +expression: output.mlf +--- +@main +def type unionnsids = { + content!: textBlock | com.example.external.imageBlock, +}; + +def type textBlock = { + text!: string, +}; diff --git a/tests/lexicon_to_mlf/union_refs_as_nsids/warnings@union_refs_as_nsids.snap b/tests/lexicon_to_mlf/union_refs_as_nsids/warnings@union_refs_as_nsids.snap new file mode 100644 index 0000000..87c353b --- /dev/null +++ b/tests/lexicon_to_mlf/union_refs_as_nsids/warnings@union_refs_as_nsids.snap @@ -0,0 +1,5 @@ +--- +source: tests/lexicon_to_mlf_integration.rs +expression: formatted_warnings +--- +[]