File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1+ from mashumaro .core .meta .types .common import clean_id
12from mashumaro .jsonschema import build_json_schema
23from mashumaro .jsonschema .models import Context
4+ from mashumaro .jsonschema .schema import _type_alias_definition_name
35
46type JSON = int | str | float | bool | None | list [JSON ] | dict [str , JSON ]
57type X = int | str
@@ -122,3 +124,14 @@ def test_type_alias_placeholder_not_leaking_into_context_defs() -> None:
122124 ]
123125 }
124126 assert ctx .definitions == {}
127+
128+
129+ def test_type_alias_definition_name_falls_back_to_clean_id_when_name_empty () -> (
130+ None
131+ ):
132+ class NamelessAlias :
133+ __name__ = ""
134+
135+ alias = NamelessAlias ()
136+
137+ assert _type_alias_definition_name (alias ) == clean_id (str (id (alias )))
You can’t perform that action at this time.
0 commit comments