sera-2 1.6.5__py3-none-any.whl → 1.6.7__py3-none-any.whl
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.
@@ -833,6 +833,17 @@ def make_typescript_data_model(schema: Schema, target_pkg: Package):
|
|
833
833
|
else expr.ExprConstant("undefined")
|
834
834
|
),
|
835
835
|
),
|
836
|
+
(
|
837
|
+
expr.ExprIdent("constraints"),
|
838
|
+
PredefinedFn.list(
|
839
|
+
[
|
840
|
+
expr.ExprConstant(
|
841
|
+
constraint.get_typescript_constraint()
|
842
|
+
)
|
843
|
+
for constraint in prop.data.constraints
|
844
|
+
]
|
845
|
+
),
|
846
|
+
),
|
836
847
|
]
|
837
848
|
+ tsprop
|
838
849
|
),
|
@@ -917,7 +928,7 @@ def make_typescript_data_model(schema: Schema, target_pkg: Package):
|
|
917
928
|
),
|
918
929
|
stmt.LineBreak(),
|
919
930
|
stmt.TypescriptStatement(
|
920
|
-
f"export const {cls.name}Schema: Schema<{cls.name}SchemaType> = "
|
931
|
+
f"export const {cls.name}Schema: Schema<{cls.name}SchemaType['id'], {cls.name}SchemaType['cls'], {cls.name}SchemaType['draftCls'], {cls.name}SchemaType['publicProperties'], {cls.name}SchemaType['allProperties'], {cls.name}SchemaType> = "
|
921
932
|
+ PredefinedFn.dict(
|
922
933
|
[
|
923
934
|
(
|
sera/models/_constraints.py
CHANGED
@@ -24,10 +24,18 @@ class Constraint:
|
|
24
24
|
"msgspec.Meta(min_length=3, max_length=32, pattern=r'^[a-zA-Z0-9_]+$')"
|
25
25
|
)
|
26
26
|
elif self.name == "password":
|
27
|
-
return "msgspec.Meta(min_length=8, max_length=
|
27
|
+
return "msgspec.Meta(min_length=8, max_length=40)"
|
28
28
|
|
29
29
|
raise NotImplementedError()
|
30
30
|
|
31
|
+
def get_typescript_constraint(self) -> str | dict:
|
32
|
+
if len(self.args) == 0:
|
33
|
+
return self.name
|
34
|
+
return {
|
35
|
+
"name": self.name,
|
36
|
+
"args": self.args,
|
37
|
+
}
|
38
|
+
|
31
39
|
|
32
40
|
predefined_constraints: dict[ConstraintName, Constraint] = {
|
33
41
|
"phone_number": Constraint("phone_number", ()),
|
@@ -10,14 +10,14 @@ sera/make/make_app.py,sha256=n9NtW73O3s_5Q31VHIRmnd-jEIcpDO7ksAsOdovde2s,5999
|
|
10
10
|
sera/make/make_python_api.py,sha256=RuJUm9z-4plBEtjobeOPr12o27OT-0tSeXI4ZlM3IY0,29433
|
11
11
|
sera/make/make_python_model.py,sha256=xf4revAwVWEnF6QhxbbqPyUGgXOOB--Gu3jPxsESg0Y,36593
|
12
12
|
sera/make/make_python_services.py,sha256=RsinYZdfkrTlTn9CT50VgqGs9w6IZawsJx-KEmqfnEY,2062
|
13
|
-
sera/make/make_typescript_model.py,sha256=
|
13
|
+
sera/make/make_typescript_model.py,sha256=6R5zgDRZLeX2jzu3mYmDHwupO_2OaOlahsiOZDSfTu0,43025
|
14
14
|
sera/misc/__init__.py,sha256=Dh4uDq0D4N53h3zhvmwfa5a0TPVRSUvLzb0hkFuPirk,411
|
15
15
|
sera/misc/_formatter.py,sha256=aCGYL08l8f3aLODHxSocxBBwkRYEo3K1QzCDEn3suj0,1685
|
16
16
|
sera/misc/_utils.py,sha256=V5g4oLGHOhUCR75Kkcn1w01pAvGvaepK-T8Z3pIgHjI,1450
|
17
17
|
sera/models/__init__.py,sha256=vJC5Kzo_N7wd16ocNPy1VvAZDGNiWeiAhWJ4ihATKvA,780
|
18
18
|
sera/models/_class.py,sha256=Wf0e8x6-szG9TzoFkAlqj7_dG0SCICMBw_333n3paxk,2514
|
19
19
|
sera/models/_collection.py,sha256=ZnQEriKC4X88Zz48Kn1AVZKH-1_l8OgWa-zf2kcQOOE,1414
|
20
|
-
sera/models/_constraints.py,sha256=
|
20
|
+
sera/models/_constraints.py,sha256=L6QwKL3hRJ5DvvIB4JNgLoyvTKbE9FrpYRzezM4CweE,1484
|
21
21
|
sera/models/_datatype.py,sha256=uMxK_8wBLowaIMIAYCb3V17YmkzJrKKc5orjImzqWbA,5818
|
22
22
|
sera/models/_default.py,sha256=ABggW6qdPR4ZDqIPJdJ0GCGQ-7kfsfZmQ_DchgZEa-I,137
|
23
23
|
sera/models/_enum.py,sha256=sy0q7E646F-APsqrVQ52r1fAQ_DCAeaNq5YM5QN3zIk,2070
|
@@ -27,6 +27,6 @@ sera/models/_parse.py,sha256=sJYfQtwek96ltpgxExG4xUbiLnU3qvNYhTP1CeyXGjs,9746
|
|
27
27
|
sera/models/_property.py,sha256=CmEmgOShtSyNFq05YW3tGupwCIVRzPMKudXWld8utPk,5530
|
28
28
|
sera/models/_schema.py,sha256=r-Gqg9Lb_wR3UrbNvfXXgt_qs5bts0t2Ve7aquuF_OI,1155
|
29
29
|
sera/typing.py,sha256=Q4QMfbtfrCjC9tFfsZPhsAnbNX4lm4NHQ9lmjNXYdV0,772
|
30
|
-
sera_2-1.6.
|
31
|
-
sera_2-1.6.
|
32
|
-
sera_2-1.6.
|
30
|
+
sera_2-1.6.7.dist-info/METADATA,sha256=aqcUqMwOA87kdUt7P3mLpj4HgjOZxLcIatDVjVl_3-Q,856
|
31
|
+
sera_2-1.6.7.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
32
|
+
sera_2-1.6.7.dist-info/RECORD,,
|
File without changes
|