sera-2 1.7.2__tar.gz → 1.7.3__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.7.2 → sera_2-1.7.3}/PKG-INFO +1 -1
  2. {sera_2-1.7.2 → sera_2-1.7.3}/pyproject.toml +1 -1
  3. {sera_2-1.7.2 → sera_2-1.7.3}/sera/make/make_typescript_model.py +33 -4
  4. {sera_2-1.7.2 → sera_2-1.7.3}/README.md +0 -0
  5. {sera_2-1.7.2 → sera_2-1.7.3}/sera/__init__.py +0 -0
  6. {sera_2-1.7.2 → sera_2-1.7.3}/sera/constants.py +0 -0
  7. {sera_2-1.7.2 → sera_2-1.7.3}/sera/libs/__init__.py +0 -0
  8. {sera_2-1.7.2 → sera_2-1.7.3}/sera/libs/api_helper.py +0 -0
  9. {sera_2-1.7.2 → sera_2-1.7.3}/sera/libs/base_orm.py +0 -0
  10. {sera_2-1.7.2 → sera_2-1.7.3}/sera/libs/base_service.py +0 -0
  11. {sera_2-1.7.2 → sera_2-1.7.3}/sera/libs/dag/__init__.py +0 -0
  12. {sera_2-1.7.2 → sera_2-1.7.3}/sera/libs/dag/_dag.py +0 -0
  13. {sera_2-1.7.2 → sera_2-1.7.3}/sera/make/__init__.py +0 -0
  14. {sera_2-1.7.2 → sera_2-1.7.3}/sera/make/__main__.py +0 -0
  15. {sera_2-1.7.2 → sera_2-1.7.3}/sera/make/make_app.py +0 -0
  16. {sera_2-1.7.2 → sera_2-1.7.3}/sera/make/make_python_api.py +0 -0
  17. {sera_2-1.7.2 → sera_2-1.7.3}/sera/make/make_python_model.py +0 -0
  18. {sera_2-1.7.2 → sera_2-1.7.3}/sera/make/make_python_services.py +0 -0
  19. {sera_2-1.7.2 → sera_2-1.7.3}/sera/misc/__init__.py +0 -0
  20. {sera_2-1.7.2 → sera_2-1.7.3}/sera/misc/_formatter.py +0 -0
  21. {sera_2-1.7.2 → sera_2-1.7.3}/sera/misc/_utils.py +0 -0
  22. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/__init__.py +0 -0
  23. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_class.py +0 -0
  24. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_collection.py +0 -0
  25. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_constraints.py +0 -0
  26. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_datatype.py +0 -0
  27. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_default.py +0 -0
  28. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_enum.py +0 -0
  29. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_module.py +0 -0
  30. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_multi_lingual_string.py +0 -0
  31. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_parse.py +0 -0
  32. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_property.py +0 -0
  33. {sera_2-1.7.2 → sera_2-1.7.3}/sera/models/_schema.py +0 -0
  34. {sera_2-1.7.2 → sera_2-1.7.3}/sera/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sera-2
3
- Version: 1.7.2
3
+ Version: 1.7.3
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.7.2"
3
+ version = "1.7.3"
4
4
  description = ""
5
5
  authors = ["Binh Vu <bvu687@gmail.com>"]
6
6
  readme = "README.md"
@@ -506,6 +506,26 @@ def make_typescript_data_model(schema: Schema, target_pkg: Package):
506
506
  )
507
507
  )
508
508
 
509
+ # TODO: fix me!
510
+ prop_validators.append(
511
+ (
512
+ expr.ExprIdent(propname),
513
+ expr.ExprFuncCall(
514
+ expr.ExprIdent("getValidator"),
515
+ [
516
+ PredefinedFn.list(
517
+ [
518
+ expr.ExprConstant(
519
+ constraint.get_typescript_constraint()
520
+ )
521
+ for constraint in prop.data.constraints
522
+ ]
523
+ ),
524
+ ],
525
+ ),
526
+ )
527
+ )
528
+
509
529
  prop_defs.append(stmt.DefClassVarStatement(propname, tstype.type))
510
530
  prop_constructor_assigns.append(
511
531
  stmt.AssignStatement(
@@ -570,10 +590,6 @@ def make_typescript_data_model(schema: Schema, target_pkg: Package):
570
590
  lambda ast10: ast10.class_(draft_clsname)(
571
591
  *prop_defs,
572
592
  stmt.LineBreak(),
573
- stmt.DefClassVarStatement(
574
- "validators", type=None, value=validators, is_static=True
575
- ),
576
- stmt.LineBreak(),
577
593
  lambda ast10: ast10.func(
578
594
  "constructor",
579
595
  [
@@ -658,6 +674,12 @@ def make_typescript_data_model(schema: Schema, target_pkg: Package):
658
674
  ),
659
675
  ),
660
676
  ),
677
+ stmt.LineBreak(),
678
+ stmt.TypescriptStatement(
679
+ f"export const draft{cls.name}Validators = "
680
+ + validators.to_typescript()
681
+ + ";"
682
+ ),
661
683
  )
662
684
 
663
685
  pkg.module("Draft" + cls.name).write(program)
@@ -904,6 +926,9 @@ def make_typescript_data_model(schema: Schema, target_pkg: Package):
904
926
  program.import_(
905
927
  f"@.models.{pkg.dir.name}.Draft{cls.name}.Draft{cls.name}", True
906
928
  )
929
+ program.import_(
930
+ f"@.models.{pkg.dir.name}.Draft{cls.name}.draft{cls.name}Validators", True
931
+ )
907
932
  program.root(
908
933
  stmt.LineBreak(),
909
934
  stmt.TypescriptStatement(
@@ -995,6 +1020,10 @@ def make_typescript_data_model(schema: Schema, target_pkg: Package):
995
1020
  + "}"
996
1021
  ),
997
1022
  ),
1023
+ (
1024
+ expr.ExprIdent("validators"),
1025
+ expr.ExprIdent(f"draft{cls.name}Validators"),
1026
+ ),
998
1027
  ]
999
1028
  + (
1000
1029
  [
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