fastgenerateapi 1.1.24__py2.py3-none-any.whl → 1.1.26__py2.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.

Potentially problematic release.


This version of fastgenerateapi might be problematic. Click here for more details.

@@ -8,7 +8,7 @@
8
8
  # d8888P
9
9
 
10
10
 
11
- VERSION = (1, 1, 24)
11
+ VERSION = (1, 1, 26)
12
12
 
13
13
  __version__ = '.'.join(map(str, VERSION))
14
14
 
@@ -227,7 +227,7 @@ class BaseView(BaseMixin, ResponseMixin, ToolMixin, DBModelMixin):
227
227
  return result
228
228
 
229
229
  def gen_get_one_response_schema(self):
230
- if not hasattr(self, "get_one_schema"):
230
+ if not hasattr(self, "get_one_schema") or not self.get_one_schema:
231
231
  get_one_schema_include = []
232
232
  if hasattr(self, "is_with_prefetch") and self.is_with_prefetch and self.prefetch_related_fields:
233
233
  for key, value in self.prefetch_related_fields.items():
@@ -247,8 +247,7 @@ class BaseView(BaseMixin, ResponseMixin, ToolMixin, DBModelMixin):
247
247
  :return:
248
248
  """
249
249
  self.gen_get_one_response_schema()
250
- if not hasattr(self, "get_one_response_schema"):
251
- self.get_one_response_schema_factory = response_factory(self.get_one_schema, name="GetOne")
250
+ self.get_one_response_schema_factory = response_factory(self.get_one_schema, name="GetOne")
252
251
 
253
252
  return self.get_one_response_schema_factory
254
253
 
@@ -26,7 +26,7 @@ def common_schema_factory(
26
26
  include_fields = set()
27
27
  exclude_fields = set()
28
28
  if exclude_readonly:
29
- exclude_fields.update(["id", "is_active", "deleted_at", "created_at", "modified_at", "updated_at"])
29
+ exclude_fields.update(["id", "created_at", "modified_at", "updated_at"])
30
30
  if hasattr(model_class, "PydanticMeta"):
31
31
  if hasattr(model_class.PydanticMeta, "include"):
32
32
  include_fields_dict = get_dict_from_pydanticmeta(model_class, model_class.PydanticMeta.include)
@@ -15,7 +15,8 @@ def create_schema_factory(
15
15
  model_class: Type[Model],
16
16
  include: Union[list, tuple, set] = None,
17
17
  extra_include: Union[list, tuple, set] = None,
18
- exclude: Union[list, tuple, set] = ("created_at", "updated_at", "modified_at"),
18
+ exclude: Union[list, tuple, set] = None,
19
+ frozen_exclude: Union[list, tuple, set] = ("created_at", "updated_at", "modified_at"),
19
20
  name: Optional[str] = None
20
21
  ) -> Type[T]:
21
22
  """
@@ -58,7 +59,9 @@ def create_schema_factory(
58
59
  all_fields_info.update(include_fields_dict)
59
60
  include_fields.update(include_fields_dict.keys())
60
61
  if exclude:
61
- exclude_fields.update(exclude)
62
+ exclude_fields.update(set(exclude))
63
+ if frozen_exclude:
64
+ exclude_fields.update(set(frozen_exclude))
62
65
 
63
66
  all_fields = include_fields.difference(exclude_fields)
64
67
  try:
@@ -15,7 +15,8 @@ def update_schema_factory(
15
15
  model_class: Type[Model],
16
16
  include: Union[list, tuple, set] = None,
17
17
  extra_include: Union[list, tuple, set] = None,
18
- exclude: Union[list, tuple, set] = ("created_at", "updated_at", "modified_at"),
18
+ exclude: Union[list, tuple, set] = None,
19
+ frozen_exclude: Union[list, tuple, set] = ("created_at", "updated_at", "modified_at"),
19
20
  name: Optional[str] = None
20
21
  ) -> Type[T]:
21
22
  """
@@ -58,7 +59,9 @@ def update_schema_factory(
58
59
  all_fields_info.update(include_fields_dict)
59
60
  include_fields.update(include_fields_dict.keys())
60
61
  if exclude:
61
- exclude_fields.update(exclude)
62
+ exclude_fields.update(set(exclude))
63
+ if frozen_exclude:
64
+ exclude_fields.update(set(frozen_exclude))
62
65
 
63
66
  all_fields = include_fields.difference(exclude_fields)
64
67
  try:
@@ -85,10 +85,14 @@ class SettingsModel(BaseModel):
85
85
  :return:
86
86
  """
87
87
  is_yaml = False
88
- if path and str(path).__contains__('.yaml'):
89
- is_yaml = True
88
+ if path:
89
+ if str(path).__contains__('.yaml'):
90
+ is_yaml = True
90
91
  elif os.path.isfile("application.yaml"):
92
+ path = "application.yaml"
91
93
  is_yaml = True
94
+ else:
95
+ path = ".env"
92
96
 
93
97
  setting_models = cls.model_fields.copy()
94
98
  setting_dict = {}
@@ -136,7 +140,7 @@ class SettingsModel(BaseModel):
136
140
  ...
137
141
 
138
142
 
139
- settings = SettingsModel()
143
+ settings = SettingsModel.get_global_settings()
140
144
 
141
145
 
142
146
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastgenerateapi
3
- Version: 1.1.24
3
+ Version: 1.1.26
4
4
  Summary: FastAPIView Class View
5
5
  Author: ShiLiang
6
6
  Author-email: 2509144896@qq.com
@@ -1,8 +1,8 @@
1
1
  fastgenerateapi/__init__.py,sha256=eh2qtp7FbjrgaRX5b3H3UWpasFdNHbVFqLUhpqVbaTU,1287
2
- fastgenerateapi/__version__.py,sha256=eW8CjgDcaG7vlxuQUvxU_3udMyEAq-pece0UKXkKj_M,497
2
+ fastgenerateapi/__version__.py,sha256=_gnFpEQW3CdVHiQce_xMlnkq0tPnh9pNAmnqsrbhFTQ,497
3
3
  fastgenerateapi/api_view/__init__.py,sha256=zkaTX5JxsNfjF-dFeEbHfUB58vhPMjm6Iiqx9HgJOrY,14
4
4
  fastgenerateapi/api_view/api_view.py,sha256=mfD8GB-hnyI2XO3tkSOlEa2FfBLdq0_Wqvp8gFrXFKU,1160
5
- fastgenerateapi/api_view/base_view.py,sha256=Ld3aagahoUz13Nxc8ranRywjCwFaY1DLEFEr4WVIC2Q,11286
5
+ fastgenerateapi/api_view/base_view.py,sha256=0Ll7gDdORhtY2SU2mC_CxprZb0S_co07VMZd1SchqyA,11251
6
6
  fastgenerateapi/api_view/create_view.py,sha256=tjCpty56wZZB6b2Hf1qsNuDUyuZzWti1ShXoxpuIgtM,4918
7
7
  fastgenerateapi/api_view/delete_filter_view.py,sha256=j3zivcB7Ul3QX2BwHnumEx6bxAUliATYvPae2iLeIbU,3312
8
8
  fastgenerateapi/api_view/delete_tree_view.py,sha256=AEQVpLjhSdQfQD5Mp1fQrAkIafMyf3UtLUqfRMItrfg,4430
@@ -72,8 +72,8 @@ fastgenerateapi/pydantic_utils/base_settings.py,sha256=JydmNHS_vl3ys7yiXwkZuRZ-4
72
72
  fastgenerateapi/pydantic_utils/json_encoders.py,sha256=EdQfpADCB5Ims3EWtTxhGZj4ypTm7EMmmnjS9-IzPWI,2946
73
73
  fastgenerateapi/schemas_factory/__init__.py,sha256=X9U96fiyRfCY0u6SzaCYG62RdpEGFX7yOZh_cJl6R2E,472
74
74
  fastgenerateapi/schemas_factory/common_function.py,sha256=ECTCFEVuMg2uQMuFGq66XhcIPZWeXLNba2PUXC4FGvA,5589
75
- fastgenerateapi/schemas_factory/common_schema_factory.py,sha256=ac_tYOcBqpnGVSkx4NCAZz3Hd1PHmwSocBRld5Jxro4,2904
76
- fastgenerateapi/schemas_factory/create_schema_factory.py,sha256=rkah8geyfMkfqA6IhHDxq-lFomn8DA3bca1AtFcrLpQ,3733
75
+ fastgenerateapi/schemas_factory/common_schema_factory.py,sha256=zJuJcVsz9qexduSsYEssgtRVaCPcEzQdVHDU88Yb_1g,2877
76
+ fastgenerateapi/schemas_factory/create_schema_factory.py,sha256=LBKcs_LcW6cvXlcPyKapxBypr6A5fvnGJJxk1-zfeQw,3871
77
77
  fastgenerateapi/schemas_factory/filter_schema_factory.py,sha256=T4Kpv8G9VAOOZKnRDh2oD3tE_xhsjw2FtEmncJa_MYM,1531
78
78
  fastgenerateapi/schemas_factory/get_all_schema_factory.py,sha256=yGjcLh0IMYLRxnCSvkVIbRjv40f5214FO9Kn6tfVoII,5442
79
79
  fastgenerateapi/schemas_factory/get_one_schema_factory.py,sha256=cgKoCOSK-4Lky8xUoZHIMAZmVSyWOW5-DmxaM6RAQEY,3431
@@ -81,9 +81,9 @@ fastgenerateapi/schemas_factory/get_relation_schema_factory.py,sha256=VvzWaxAwOn
81
81
  fastgenerateapi/schemas_factory/get_tree_schema_factory.py,sha256=v0DAf7kwB-17rHbkzVscLkm6Jh53qa2cieQ7awH78pw,7259
82
82
  fastgenerateapi/schemas_factory/response_factory.py,sha256=C-E3lqIdfIJCIZhvmSaAiNJpYVOs6AGVyl90B5KRo4M,1655
83
83
  fastgenerateapi/schemas_factory/sql_get_all_schema_factory.py,sha256=dhgMvXZIq4av7puIMiQOTuVqNOuBoMvBZVd98GWJTRg,1810
84
- fastgenerateapi/schemas_factory/update_schema_factory.py,sha256=E-86vF98Ed92Q2VFqtS35xqxr_c34du9ok42JBfnj1g,3729
84
+ fastgenerateapi/schemas_factory/update_schema_factory.py,sha256=WZRciMnIfI3wCEQ9K4034yjM43qUM7rbZdDwUHN8E4A,3867
85
85
  fastgenerateapi/settings/__init__.py,sha256=AOvd7RM_jdrtw7jazw_IoGV5tPOXw2t0OOG1rZU36XI,199
86
- fastgenerateapi/settings/all_settings.py,sha256=TQo4w7ws2xJWg5A43L9f4aMLLQ_XjqswrSj6_2Ys4-8,5747
86
+ fastgenerateapi/settings/all_settings.py,sha256=uaIG9Xntn6rBS2KtslPAT1ynRxvDHBTWfS7D9i-HQSw,5865
87
87
  fastgenerateapi/settings/app_settings.py,sha256=kq0O4FZMveiLdzwRkkH1E1byccoNGlLyz7G4fNTZm6w,7357
88
88
  fastgenerateapi/settings/db_settings.py,sha256=uVUbhUQxhbMkwhU5UDG8eE4nf_Blg8bPxLCIEDSMTO4,1570
89
89
  fastgenerateapi/settings/etcd_settings.py,sha256=agPHJmIp_w_3iWCKKLIWSdp22cbJtc6kBSoa8fB5IXM,1526
@@ -104,8 +104,8 @@ fastgenerateapi/utils/snowflake.py,sha256=GiFVkE10sPiqJ094sMfrPsaV7Y9Y3c1djrSfgs
104
104
  fastgenerateapi/utils/str_util.py,sha256=c-jUlCFw-Dz4W1W9Jc1TqGZw3JXu-qN5ovnE6fjc9j0,3445
105
105
  fastgenerateapi/utils/swagger_to_js.py,sha256=pPPTag6TYtxdbKMHD3m8lJvc8Gv9HC97CGHt4esU1-E,530
106
106
  script/__init__.py,sha256=26UWatnbm6ZIwQMuu9NNzQ0IW1ACO4Oe9caModuTpWM,4
107
- fastgenerateapi-1.1.24.dist-info/LICENSE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
108
- fastgenerateapi-1.1.24.dist-info/METADATA,sha256=cuSzwftvHIfxmXoxJo8_Y8HwXgMxoIgj-rLf6pXwf44,6025
109
- fastgenerateapi-1.1.24.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
110
- fastgenerateapi-1.1.24.dist-info/top_level.txt,sha256=CW2SlpYjTRdacF-5ufnPMtwpYcR0XYn_bDxa2ZrrTBI,23
111
- fastgenerateapi-1.1.24.dist-info/RECORD,,
107
+ fastgenerateapi-1.1.26.dist-info/LICENSE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
108
+ fastgenerateapi-1.1.26.dist-info/METADATA,sha256=C8cePn8eYwe1IlEO5MvYkcFWh7y4BZ6rN3ghRBSNebM,6025
109
+ fastgenerateapi-1.1.26.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
110
+ fastgenerateapi-1.1.26.dist-info/top_level.txt,sha256=CW2SlpYjTRdacF-5ufnPMtwpYcR0XYn_bDxa2ZrrTBI,23
111
+ fastgenerateapi-1.1.26.dist-info/RECORD,,