mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-12-19 11:52:19 -06:00
set param required tag to False by default
PiperOrigin-RevId: 754382785
This commit is contained in:
committed by
Copybara-Service
parent
24024f7fc4
commit
5846b24b71
@@ -484,11 +484,9 @@ class DatabaseSessionService(BaseSessionService):
|
||||
|
||||
if storage_session.update_time.timestamp() > session.last_update_time:
|
||||
raise ValueError(
|
||||
f"Session last_update_time "
|
||||
f"{datetime.fromtimestamp(session.last_update_time):%Y-%m-%d %H:%M:%S} "
|
||||
f"is later than the update_time in storage "
|
||||
f"{storage_session.update_time:%Y-%m-%d %H:%M:%S}"
|
||||
)
|
||||
f"Session last_update_time {session.last_update_time} is later than"
|
||||
f" the upate_time in storage {storage_session.update_time}"
|
||||
)
|
||||
|
||||
# Fetch states from storage
|
||||
storage_app_state = sessionFactory.get(
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
|
||||
import keyword
|
||||
import re
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from typing import Union
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from fastapi.openapi.models import Response
|
||||
from fastapi.openapi.models import Schema
|
||||
@@ -100,7 +96,7 @@ class ApiParameter(BaseModel):
|
||||
py_name: Optional[str] = ''
|
||||
type_value: type[Any] = Field(default=None, init_var=False)
|
||||
type_hint: str = Field(default=None, init_var=False)
|
||||
required: Optional[bool] = None
|
||||
required: bool = False
|
||||
|
||||
def model_post_init(self, _: Any):
|
||||
self.py_name = (
|
||||
|
||||
@@ -17,9 +17,13 @@ from textwrap import dedent
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.openapi.models import Operation, Parameter, Schema
|
||||
from fastapi.openapi.models import Operation
|
||||
from fastapi.openapi.models import Parameter
|
||||
from fastapi.openapi.models import Schema
|
||||
|
||||
from ..common.common import ApiParameter, PydocHelper, to_snake_case
|
||||
from ..common.common import ApiParameter
|
||||
from ..common.common import PydocHelper
|
||||
from ..common.common import to_snake_case
|
||||
|
||||
|
||||
class OperationParser:
|
||||
@@ -76,7 +80,9 @@ class OperationParser:
|
||||
description = param.description or ''
|
||||
location = param.in_ or ''
|
||||
schema = param.schema_ or {} # Use schema_ instead of .schema
|
||||
schema.description = description if schema.description is None and description != '' else schema.description
|
||||
schema.description = (
|
||||
description if not schema.description else schema.description
|
||||
)
|
||||
required = param.required
|
||||
|
||||
self.params.append(
|
||||
@@ -85,7 +91,7 @@ class OperationParser:
|
||||
param_location=location,
|
||||
param_schema=schema,
|
||||
description=description,
|
||||
required=required
|
||||
required=required,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -233,7 +239,7 @@ class OperationParser:
|
||||
}
|
||||
return {
|
||||
'properties': properties,
|
||||
'required': [p.py_name for p in self.params if p.required is not False],
|
||||
'required': [p.py_name for p in self.params if p.required],
|
||||
'title': f"{self.operation.operationId or 'unnamed'}_Arguments",
|
||||
'type': 'object',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user