mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 09:51: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] = ''
|
py_name: Optional[str] = ''
|
||||||
type_value: type[Any] = Field(default=None, init_var=False)
|
type_value: type[Any] = Field(default=None, init_var=False)
|
||||||
type_hint: str = 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):
|
def model_post_init(self, _: Any):
|
||||||
self.py_name = (
|
self.py_name = (
|
||||||
|
@ -76,6 +76,8 @@ class OperationParser:
|
|||||||
description = param.description or ''
|
description = param.description or ''
|
||||||
location = param.in_ or ''
|
location = param.in_ or ''
|
||||||
schema = param.schema_ or {} # Use schema_ instead of .schema
|
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(
|
self.params.append(
|
||||||
ApiParameter(
|
ApiParameter(
|
||||||
@ -83,6 +85,7 @@ class OperationParser:
|
|||||||
param_location=location,
|
param_location=location,
|
||||||
param_schema=schema,
|
param_schema=schema,
|
||||||
description=description,
|
description=description,
|
||||||
|
required=required
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -230,7 +233,7 @@ class OperationParser:
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
'properties': properties,
|
'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",
|
'title': f"{self.operation.operationId or 'unnamed'}_Arguments",
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user