mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 09:51:25 -06:00
Fixed Parameter required field and description
This commit is contained in:
parent
61d4be2d76
commit
27b214df3e
@ -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 = (
|
||||||
|
@ -84,6 +84,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(
|
||||||
@ -91,6 +93,7 @@ class OperationParser:
|
|||||||
param_location=location,
|
param_location=location,
|
||||||
param_schema=schema,
|
param_schema=schema,
|
||||||
description=description,
|
description=description,
|
||||||
|
required=required
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -237,7 +240,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