Skip to content

Commit 308471f

Browse files
author
Raphael Krupinski
committed
🐛 Avoid name clashes by generating schemas to submodules.
1 parent 23208fc commit 308471f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lapidary/render/model/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _process_schema_object(self, value: openapi.Schema, stack: Stack) -> python.
4343
python.ModelType[value.lapidary_model_type.name] if value.lapidary_model_type else python.ModelType.model
4444
)
4545

46-
type_hint = resolve_type_hint(str(self.root_package), stack)
46+
type_hint = resolve_type_hint(str(self.root_package), stack.push('schema', name))
4747
schema_class = python.SchemaClass(
4848
class_name=name,
4949
base_type=base_type,
@@ -168,7 +168,7 @@ def schema_modules(self) -> Iterable[python.SchemaModule]:
168168
modules: dict[python.ModulePath, list[python.SchemaClass]] = defaultdict(list)
169169
for pointer, schema_class_type in self.schema_types.items():
170170
schema_class, hint = schema_class_type
171-
modules[python.ModulePath(hint.module)].append(schema_class)
171+
modules[python.ModulePath(hint.module) / '__init__'].append(schema_class)
172172
return [
173173
python.SchemaModule(
174174
path=module,

0 commit comments

Comments
 (0)