sera-2 1.8.2__tar.gz → 1.9.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {sera_2-1.8.2 → sera_2-1.9.1}/PKG-INFO +1 -1
  2. {sera_2-1.8.2 → sera_2-1.9.1}/pyproject.toml +1 -1
  3. {sera_2-1.8.2 → sera_2-1.9.1}/sera/make/make_python_model.py +7 -6
  4. {sera_2-1.8.2 → sera_2-1.9.1}/sera/make/make_typescript_model.py +2 -6
  5. {sera_2-1.8.2 → sera_2-1.9.1}/README.md +0 -0
  6. {sera_2-1.8.2 → sera_2-1.9.1}/sera/__init__.py +0 -0
  7. {sera_2-1.8.2 → sera_2-1.9.1}/sera/constants.py +0 -0
  8. {sera_2-1.8.2 → sera_2-1.9.1}/sera/libs/__init__.py +0 -0
  9. {sera_2-1.8.2 → sera_2-1.9.1}/sera/libs/api_helper.py +0 -0
  10. {sera_2-1.8.2 → sera_2-1.9.1}/sera/libs/base_orm.py +0 -0
  11. {sera_2-1.8.2 → sera_2-1.9.1}/sera/libs/base_service.py +0 -0
  12. {sera_2-1.8.2 → sera_2-1.9.1}/sera/libs/dag/__init__.py +0 -0
  13. {sera_2-1.8.2 → sera_2-1.9.1}/sera/libs/dag/_dag.py +0 -0
  14. {sera_2-1.8.2 → sera_2-1.9.1}/sera/make/__init__.py +0 -0
  15. {sera_2-1.8.2 → sera_2-1.9.1}/sera/make/__main__.py +0 -0
  16. {sera_2-1.8.2 → sera_2-1.9.1}/sera/make/make_app.py +0 -0
  17. {sera_2-1.8.2 → sera_2-1.9.1}/sera/make/make_python_api.py +0 -0
  18. {sera_2-1.8.2 → sera_2-1.9.1}/sera/make/make_python_services.py +0 -0
  19. {sera_2-1.8.2 → sera_2-1.9.1}/sera/misc/__init__.py +0 -0
  20. {sera_2-1.8.2 → sera_2-1.9.1}/sera/misc/_formatter.py +0 -0
  21. {sera_2-1.8.2 → sera_2-1.9.1}/sera/misc/_utils.py +0 -0
  22. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/__init__.py +0 -0
  23. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_class.py +0 -0
  24. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_collection.py +0 -0
  25. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_constraints.py +0 -0
  26. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_datatype.py +0 -0
  27. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_default.py +0 -0
  28. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_enum.py +0 -0
  29. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_module.py +0 -0
  30. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_multi_lingual_string.py +0 -0
  31. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_parse.py +0 -0
  32. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_property.py +0 -0
  33. {sera_2-1.8.2 → sera_2-1.9.1}/sera/models/_schema.py +0 -0
  34. {sera_2-1.8.2 → sera_2-1.9.1}/sera/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sera-2
3
- Version: 1.8.2
3
+ Version: 1.9.1
4
4
  Summary:
5
5
  Author: Binh Vu
6
6
  Author-email: bvu687@gmail.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "sera-2"
3
- version = "1.8.2"
3
+ version = "1.9.1"
4
4
  description = ""
5
5
  authors = ["Binh Vu <bvu687@gmail.com>"]
6
6
  readme = "README.md"
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  from typing import Callable, Sequence
4
4
 
5
5
  from codegen.models import AST, DeferredVar, PredefinedFn, Program, expr, stmt
6
+
6
7
  from sera.misc import (
7
8
  assert_isinstance,
8
9
  assert_not_null,
@@ -206,12 +207,6 @@ def make_python_data_model(
206
207
  program.import_(pytype.dep, True)
207
208
 
208
209
  pytype_type = pytype.type
209
- if prop.data.is_private:
210
- program.import_("typing.Union", True)
211
- program.import_("sera.typing.UnsetType", True)
212
- program.import_("sera.typing.UNSET", True)
213
- pytype_type = f"Union[{pytype_type}, UnsetType]"
214
-
215
210
  if len(prop.data.constraints) > 0:
216
211
  # if the property has constraints, we need to figure out
217
212
  program.import_("typing.Annotated", True)
@@ -223,6 +218,12 @@ def make_python_data_model(
223
218
  else:
224
219
  raise NotImplementedError(prop.data.constraints)
225
220
 
221
+ if prop.data.is_private:
222
+ program.import_("typing.Union", True)
223
+ program.import_("sera.typing.UnsetType", True)
224
+ program.import_("sera.typing.UNSET", True)
225
+ pytype_type = f"Union[{pytype_type}, UnsetType]"
226
+
226
227
  prop_default_value = None
227
228
  if prop.data.is_private:
228
229
  prop_default_value = expr.ExprIdent("UNSET")
@@ -863,10 +863,6 @@ def make_typescript_data_model(schema: Schema, target_pkg: Package):
863
863
  program.import_(tstype.dep, True)
864
864
  tsprop = [
865
865
  (expr.ExprIdent("datatype"), expr.ExprConstant(tstype.type)),
866
- (
867
- expr.ExprIdent("isList"),
868
- expr.ExprConstant(prop.get_data_model_datatype().is_list),
869
- ),
870
866
  (
871
867
  expr.ExprIdent("isRequired"),
872
868
  expr.ExprConstant(
@@ -907,8 +903,8 @@ def make_typescript_data_model(schema: Schema, target_pkg: Package):
907
903
  ),
908
904
  (expr.ExprIdent("datatype"), expr.ExprConstant(tstype.type)),
909
905
  (
910
- expr.ExprIdent("isList"),
911
- expr.ExprConstant(prop.cardinality.is_star_to_many()),
906
+ expr.ExprIdent("cardinality"),
907
+ expr.ExprConstant(prop.cardinality.value),
912
908
  ),
913
909
  (
914
910
  expr.ExprIdent("isEmbedded"),
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes