Skip to content

Commit 4e7e917

Browse files
committed
refactor: minor change
1 parent b58ded4 commit 4e7e917

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

schema_salad/rust_codegen.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,15 +817,16 @@ def __parse_record_schema(self, record: RecordSchema) -> RustPath:
817817
ident = rust_sanitize_type_ident(avro_shortname(record.name))
818818
attrs, _ = self.__parse_named_schema_attrs(record)
819819
fields = set(self.__parse_record_field(f, record) for f in record.fields)
820+
is_doc_root = record.get_prop("documentRoot") or False
820821

821-
if record.get_prop("documentRoot"):
822+
if is_doc_root:
822823
attrs = [*attrs, self.document_root_attr]
823824

824825
rust_path = self.__module_tree \
825826
.add_submodule(self.__get_submodule_path(record)) \
826827
.add_named_type(RustStruct(ident=ident, attrs=attrs, fields=fields)) # fmt: skip
827828

828-
if record.get_prop("documentRoot"):
829+
if is_doc_root:
829830
self.__document_root_paths.append(rust_path)
830831
return rust_path
831832

0 commit comments

Comments
 (0)