fastgenerateapi 1.1.25__py2.py3-none-any.whl → 1.1.27__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, 25)
11
+ VERSION = (1, 1, 27)
12
12
 
13
13
  __version__ = '.'.join(map(str, VERSION))
14
14
 
@@ -18,12 +18,16 @@ def get_field_info(value, description="", default_field_type=None) -> (Type, Fie
18
18
  value.field_type = default_field_type
19
19
  else:
20
20
  value.field_type = str
21
+ field_info_dict = {}
21
22
  if hasattr(value, "null") and value.null:
22
23
  field_type = Optional[value.field_type]
24
+ field_info_dict["default"] = None
23
25
  else:
24
26
  field_type = value.field_type
25
27
  required = True
26
- field_info_dict = {"required": required}
28
+ field_info_dict["required"] = required
29
+ # if not required and hasattr(value, "default") and not hasattr(value.default, '__call__'):
30
+ # field_info_dict.setdefault("default", value.default)
27
31
  if not required and hasattr(value, "default") and not hasattr(value.default, '__call__'):
28
32
  field_info_dict.setdefault("default", value.default)
29
33
  if hasattr(value, "description"):
@@ -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 = {}
@@ -121,10 +125,7 @@ class SettingsModel(BaseModel):
121
125
  setting_dict[k] = v.annotation(**annotation_dict)
122
126
 
123
127
  setting_data = cls(**setting_dict)
124
- global settings
125
- settings.app_settings = setting_data.app_settings
126
- settings.system_settings = setting_data.system_settings
127
- settings.redis_settings = setting_data.redis_settings
128
+
128
129
  return setting_data
129
130
 
130
131
  def watch(self):
@@ -136,7 +137,7 @@ class SettingsModel(BaseModel):
136
137
  ...
137
138
 
138
139
 
139
- settings = SettingsModel()
140
+ settings = SettingsModel.get_global_settings()
140
141
 
141
142
 
142
143
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastgenerateapi
3
- Version: 1.1.25
3
+ Version: 1.1.27
4
4
  Summary: FastAPIView Class View
5
5
  Author: ShiLiang
6
6
  Author-email: 2509144896@qq.com
@@ -1,5 +1,5 @@
1
1
  fastgenerateapi/__init__.py,sha256=eh2qtp7FbjrgaRX5b3H3UWpasFdNHbVFqLUhpqVbaTU,1287
2
- fastgenerateapi/__version__.py,sha256=tP-SI9FJ5U3gRsZCPk5M1SPJbgdtN00luV5I6eTbE_k,497
2
+ fastgenerateapi/__version__.py,sha256=-98csuEDZfM9KAiiI26BstAu4QLsSN_vGKp5UCBYeFk,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
5
  fastgenerateapi/api_view/base_view.py,sha256=0Ll7gDdORhtY2SU2mC_CxprZb0S_co07VMZd1SchqyA,11251
@@ -71,9 +71,9 @@ fastgenerateapi/pydantic_utils/base_model.py,sha256=kHFcx48UbpMgLfKdNT351p74PZCd
71
71
  fastgenerateapi/pydantic_utils/base_settings.py,sha256=JydmNHS_vl3ys7yiXwkZuRZ-4tIgf0a_kfft7WNf4kY,533
72
72
  fastgenerateapi/pydantic_utils/json_encoders.py,sha256=EdQfpADCB5Ims3EWtTxhGZj4ypTm7EMmmnjS9-IzPWI,2946
73
73
  fastgenerateapi/schemas_factory/__init__.py,sha256=X9U96fiyRfCY0u6SzaCYG62RdpEGFX7yOZh_cJl6R2E,472
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
74
+ fastgenerateapi/schemas_factory/common_function.py,sha256=K0jOZ6wGgSGVkdwoPt9dM6xwnluIFyzj2oSceg64MHU,5817
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=ivzELwGouM8RLZ6HXKQs7Z2Y_RHBmQroQJ6AWflmK74,5655
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.25.dist-info/LICENSE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
108
- fastgenerateapi-1.1.25.dist-info/METADATA,sha256=kfv7BSqouiXL4bM0D2wxbfbnrB6ga0eVnZSnX3iCZLU,6025
109
- fastgenerateapi-1.1.25.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
110
- fastgenerateapi-1.1.25.dist-info/top_level.txt,sha256=CW2SlpYjTRdacF-5ufnPMtwpYcR0XYn_bDxa2ZrrTBI,23
111
- fastgenerateapi-1.1.25.dist-info/RECORD,,
107
+ fastgenerateapi-1.1.27.dist-info/LICENSE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
108
+ fastgenerateapi-1.1.27.dist-info/METADATA,sha256=xFvSYlvEY8LLify-jacKExdfQptRTor8dbc8-EgNsBM,6025
109
+ fastgenerateapi-1.1.27.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
110
+ fastgenerateapi-1.1.27.dist-info/top_level.txt,sha256=CW2SlpYjTRdacF-5ufnPMtwpYcR0XYn_bDxa2ZrrTBI,23
111
+ fastgenerateapi-1.1.27.dist-info/RECORD,,