mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 01:41:25 -06:00
Copybara import of the project:
--27b214df3e
by Sumant Pangotra <sumantpangotra@gmail.com>: Fixed Parameter required field and description COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/256 from sumant-pangotra:#247-OpenAPIToolSet-Considering-Required-parameters42f87a9c94
PiperOrigin-RevId: 754050217
This commit is contained in:
parent
d387ab0c38
commit
e8fb4ed3fc
@ -100,6 +100,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
|
||||
|
||||
def model_post_init(self, _: Any):
|
||||
self.py_name = (
|
||||
|
@ -76,6 +76,8 @@ 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
|
||||
required = param.required
|
||||
|
||||
self.params.append(
|
||||
ApiParameter(
|
||||
@ -83,6 +85,7 @@ class OperationParser:
|
||||
param_location=location,
|
||||
param_schema=schema,
|
||||
description=description,
|
||||
required=required
|
||||
)
|
||||
)
|
||||
|
||||
@ -230,7 +233,7 @@ class OperationParser:
|
||||
}
|
||||
return {
|
||||
'properties': properties,
|
||||
'required': [p.py_name for p in self.params],
|
||||
'required': [p.py_name for p in self.params if p.required is not False],
|
||||
'title': f"{self.operation.operationId or 'unnamed'}_Arguments",
|
||||
'type': 'object',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user