vega-framework 0.2.3__py3-none-any.whl → 0.2.4__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.
vega/web/openapi.py CHANGED
@@ -93,15 +93,9 @@ def get_openapi_schema(
93
93
  operation["parameters"] = params
94
94
 
95
95
  # Analyze request body
96
- request_body = _get_request_body(route)
96
+ request_body = _get_request_body(route, components)
97
97
  if request_body:
98
98
  operation["requestBody"] = request_body
99
- # Add request body schemas to components
100
- if PYDANTIC_AVAILABLE and "content" in request_body:
101
- for content_type, content_schema in request_body["content"].items():
102
- if "schema" in content_schema and "$ref" in content_schema["schema"]:
103
- model_name = content_schema["schema"]["$ref"].split("/")[-1]
104
- # Model will be added when processing response_model
105
99
 
106
100
  # Analyze response model
107
101
  if route.response_model:
@@ -192,7 +186,7 @@ def _get_parameters(route: Any) -> List[Dict[str, Any]]:
192
186
  return parameters
193
187
 
194
188
 
195
- def _get_request_body(route: Any) -> Optional[Dict[str, Any]]:
189
+ def _get_request_body(route: Any, components: Dict[str, Any]) -> Optional[Dict[str, Any]]:
196
190
  """Extract request body schema from route."""
197
191
  if not PYDANTIC_AVAILABLE:
198
192
  return None
@@ -212,9 +206,12 @@ def _get_request_body(route: Any) -> Optional[Dict[str, Any]]:
212
206
 
213
207
  # Check if it's a Pydantic model
214
208
  if param_type and isinstance(param_type, type) and issubclass(param_type, BaseModel):
215
- model_schema = param_type.model_json_schema()
216
209
  model_name = param_type.__name__
217
210
 
211
+ # Add model schema to components
212
+ if model_name not in components["schemas"]:
213
+ components["schemas"][model_name] = param_type.model_json_schema()
214
+
218
215
  return {
219
216
  "required": True,
220
217
  "content": {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vega-framework
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -90,14 +90,14 @@ vega/web/builtin_middlewares.py,sha256=01iSy-pZL-Y1R-f-GHzT2GVtdRuYK_-wZFv0VP_S9
90
90
  vega/web/docs.py,sha256=yTIgJLcqNz4Zca5AbtKYJsqCz-5UJevjJ7_g04XrwVo,2979
91
91
  vega/web/exceptions.py,sha256=QxfhHntAIMwfqCvaCRro8MqKvxZxARjSoL9eTNWa5Qc,4897
92
92
  vega/web/middleware.py,sha256=DZLlkcuKOV1uPGYnaT4MsbvFWnzFVAiyGcSvi8D2Vnw,5204
93
- vega/web/openapi.py,sha256=OAdsIWa8jRwgEJruhPaOlHt0lLqW-SIr930NvtIu6ac,9636
93
+ vega/web/openapi.py,sha256=7v6EsGuVOM2TyTrlUOTqiEgHPRzOVkMmj8gWiMEQENc,9324
94
94
  vega/web/request.py,sha256=-xz6cbRAxtY0hZv62UFgg0ces0dtDcCCE_EHcw6cEms,3181
95
95
  vega/web/response.py,sha256=h5E7crRepaFRyUecasIbP3ErkRLpFQXRZhYl9OrFLWY,5641
96
96
  vega/web/route_middleware.py,sha256=zZzkXsdu7bCRcw-CXvFmTjNuyJ1v4NNM1DbEQo7l0qg,8208
97
97
  vega/web/router.py,sha256=6K6TPMZhi92jd030guYh_mdfN3Z9MTSfjy1P3xnFfdg,10575
98
98
  vega/web/routing.py,sha256=PLytM0eBBoxIkewj6BFJ6f7py3Uqery1H94ANOqQkjs,12840
99
- vega_framework-0.2.3.dist-info/METADATA,sha256=HtFX2scSAqbbUV113sln9FjQs0DqPdY3nglj4nWAYT4,11226
100
- vega_framework-0.2.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
101
- vega_framework-0.2.3.dist-info/entry_points.txt,sha256=p3gyTmPYjNRLbuiKS-hG3ytWd-ssBweFy6VZ-F9FTNk,42
102
- vega_framework-0.2.3.dist-info/licenses/LICENSE,sha256=wlHh1MBTcs2kSQr99P30mZ61s7uh7Cp9Rk0YiJxots0,1084
103
- vega_framework-0.2.3.dist-info/RECORD,,
99
+ vega_framework-0.2.4.dist-info/METADATA,sha256=YAsmxTknRbH8ioLh5GodUkav6-E-Oh9m3LQeq4EaFys,11226
100
+ vega_framework-0.2.4.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
101
+ vega_framework-0.2.4.dist-info/entry_points.txt,sha256=p3gyTmPYjNRLbuiKS-hG3ytWd-ssBweFy6VZ-F9FTNk,42
102
+ vega_framework-0.2.4.dist-info/licenses/LICENSE,sha256=wlHh1MBTcs2kSQr99P30mZ61s7uh7Cp9Rk0YiJxots0,1084
103
+ vega_framework-0.2.4.dist-info/RECORD,,