sera-2 1.8.2__py3-none-any.whl → 1.9.1__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.
sera/make/make_python_model.py
CHANGED
@@ -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("
|
911
|
-
expr.ExprConstant(prop.cardinality.
|
906
|
+
expr.ExprIdent("cardinality"),
|
907
|
+
expr.ExprConstant(prop.cardinality.value),
|
912
908
|
),
|
913
909
|
(
|
914
910
|
expr.ExprIdent("isEmbedded"),
|
@@ -10,9 +10,9 @@ sera/make/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
sera/make/__main__.py,sha256=G5O7s6135-708honwqMFn2yPTs06WbGQTHpupID0eZ4,1417
|
11
11
|
sera/make/make_app.py,sha256=n9NtW73O3s_5Q31VHIRmnd-jEIcpDO7ksAsOdovde2s,5999
|
12
12
|
sera/make/make_python_api.py,sha256=FcklRwGDGTKPjuhbHKyEog8PYPACi-5DA_nB1ZgxeJU,29424
|
13
|
-
sera/make/make_python_model.py,sha256=
|
13
|
+
sera/make/make_python_model.py,sha256=v5edXKMTQ2XAYDoM7fBONx3S9H6DRUPQp9UwWWUowLg,36594
|
14
14
|
sera/make/make_python_services.py,sha256=RsinYZdfkrTlTn9CT50VgqGs9w6IZawsJx-KEmqfnEY,2062
|
15
|
-
sera/make/make_typescript_model.py,sha256=
|
15
|
+
sera/make/make_typescript_model.py,sha256=fMjz4YxdGHijb2pHI4xj7rKJf1PxyJxVLYW0ivsu70c,50128
|
16
16
|
sera/misc/__init__.py,sha256=Dh4uDq0D4N53h3zhvmwfa5a0TPVRSUvLzb0hkFuPirk,411
|
17
17
|
sera/misc/_formatter.py,sha256=aCGYL08l8f3aLODHxSocxBBwkRYEo3K1QzCDEn3suj0,1685
|
18
18
|
sera/misc/_utils.py,sha256=V5g4oLGHOhUCR75Kkcn1w01pAvGvaepK-T8Z3pIgHjI,1450
|
@@ -29,6 +29,6 @@ sera/models/_parse.py,sha256=sJYfQtwek96ltpgxExG4xUbiLnU3qvNYhTP1CeyXGjs,9746
|
|
29
29
|
sera/models/_property.py,sha256=CmEmgOShtSyNFq05YW3tGupwCIVRzPMKudXWld8utPk,5530
|
30
30
|
sera/models/_schema.py,sha256=r-Gqg9Lb_wR3UrbNvfXXgt_qs5bts0t2Ve7aquuF_OI,1155
|
31
31
|
sera/typing.py,sha256=Q4QMfbtfrCjC9tFfsZPhsAnbNX4lm4NHQ9lmjNXYdV0,772
|
32
|
-
sera_2-1.
|
33
|
-
sera_2-1.
|
34
|
-
sera_2-1.
|
32
|
+
sera_2-1.9.1.dist-info/METADATA,sha256=Xg1hqLX0htdcQaJxgMUXAr4e_DAiDp3BiyTXXtIfHpg,856
|
33
|
+
sera_2-1.9.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
34
|
+
sera_2-1.9.1.dist-info/RECORD,,
|
File without changes
|