Skip to content

Commit 505d09c

Browse files
committed
Rename commercetools.schemas.* -> commercetools._schema.*
Since we don't import all submodules in commercetools.schemas.__init__ anymore we need to directly import it from the correct package. And since we really want to keep the schemas an implementation detail lets prefix it with a leading underscore
1 parent 685847e commit 505d09c

40 files changed

+572
-333
lines changed

codegen/generate_schema.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def add_dict_field_definition(self, resource, module_name):
148148
self._field_nodes[module_name].append(class_node)
149149

150150
def import_resource(self, source, module, cls):
151-
self.add_import_statement(source, f"commercetools.schemas.{module}", cls)
151+
self.add_import_statement(source, f"commercetools._schemas.{module}", cls)
152152

153153

154154
class SchemaClassGenerator:
@@ -412,7 +412,7 @@ def _create_discriminator_field(self, type_obj):
412412
for child in type_obj.get_all_children():
413413
items[
414414
child.discriminator_value
415-
] = f"commercetools.schemas.{child.package_name}.{child.name}Schema"
415+
] = f"commercetools._schemas.{child.package_name}.{child.name}Schema"
416416

417417
field = type_obj.get_discriminator_field()
418418
self.generator.add_import_statement(
@@ -450,7 +450,7 @@ def _create_nested_field(self, type_obj):
450450
Generated code::
451451
452452
marshmallow.fields.Nested(
453-
nested="commercetools.schemas.{package}.{object}Schema",
453+
nested="commercetools._schemas.{package}.{object}Schema",
454454
unknown=marshmallow.EXCLUDE,
455455
allow_none=True
456456
)
@@ -466,7 +466,7 @@ def _create_nested_field(self, type_obj):
466466
ast.keyword(
467467
arg="nested",
468468
value=ast.Str(
469-
s=f"commercetools.schemas.{type_obj.package_name}.{type_obj.name}Schema",
469+
s=f"commercetools._schemas.{type_obj.package_name}.{type_obj.name}Schema",
470470
kind=None,
471471
),
472472
),

0 commit comments

Comments
 (0)