Skip to content

Commit 06c3b0b

Browse files
🎨 Improve module and class names.
1 parent 1db3476 commit 06c3b0b

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

‎src/lapidary/render/model/openapi_conv.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,14 @@ def _create_envelope_model(
208208
stack: Stack,
209209
) -> python.TypeHint:
210210
envelope = python.ResponseEnvelopeModel(
211-
name=names.maybe_mangle_name(stack.top()),
211+
name='Response',
212212
headers=headers,
213213
body_type=body_type,
214214
)
215-
type_hint = resolve_type_hint(str(self.root_package), stack)
215+
type_hint = resolve_type_hint(str(self.root_package), stack.push('Response'))
216216
self.target.add_response_envelope_module(
217217
python.ResponseEnvelopeModule(
218-
path=python.ModulePath(type_hint.module),
218+
path=python.ModulePath(type_hint.module, is_module=False),
219219
body=envelope,
220220
)
221221
)

‎src/lapidary/render/model/schema.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def schema_modules(self) -> Iterable[python.SchemaModule]:
141141
modules: dict[python.ModulePath, list[python.SchemaClass]] = defaultdict(list)
142142
for pointer, schema_class_type in self.schema_types.items():
143143
schema_class, hint = schema_class_type
144-
modules[python.ModulePath(hint.module, True)].append(schema_class)
144+
modules[python.ModulePath(hint.module, is_module=True)].append(schema_class)
145145
return [
146146
python.SchemaModule(
147147
path=module,
@@ -184,8 +184,5 @@ def resolve_type_hint(root_package: str, pointer: str | Stack) -> python.TypeHin
184184
(root_package,), [names.maybe_mangle_name(json_pointer.decode_json_pointer(part)) for part in parts[:-1]]
185185
)
186186
)
187-
top: str | int = parts[-1]
188-
if isinstance(top, int):
189-
top = parts[-2] + str(top)
190-
assert isinstance(top, str)
187+
top = names.maybe_mangle_name(parts[-1])
191188
return python.TypeHint(module=module_name, name=top)

0 commit comments

Comments
 (0)