mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 01:41:25 -06:00
fix: Handle the case when parameter.required is None and fix tests
PiperOrigin-RevId: 754519323
This commit is contained in:
parent
ad4226b3d8
commit
a7b4c98253
@ -83,7 +83,8 @@ class OperationParser:
|
|||||||
schema.description = (
|
schema.description = (
|
||||||
description if not schema.description else schema.description
|
description if not schema.description else schema.description
|
||||||
)
|
)
|
||||||
required = param.required
|
# param.required can be None
|
||||||
|
required = param.required if param.required is not None else False
|
||||||
|
|
||||||
self.params.append(
|
self.params.append(
|
||||||
ApiParameter(
|
ApiParameter(
|
||||||
|
@ -347,8 +347,8 @@ def test_get_json_schema(sample_operation):
|
|||||||
assert json_schema['type'] == 'object'
|
assert json_schema['type'] == 'object'
|
||||||
assert 'param1' in json_schema['properties']
|
assert 'param1' in json_schema['properties']
|
||||||
assert 'prop1' in json_schema['properties']
|
assert 'prop1' in json_schema['properties']
|
||||||
assert 'param1' in json_schema['required']
|
# By default nothing is required unless explicitly stated
|
||||||
assert 'prop1' in json_schema['required']
|
assert 'required' not in json_schema or json_schema['required'] == []
|
||||||
|
|
||||||
|
|
||||||
def test_get_signature_parameters(sample_operation):
|
def test_get_signature_parameters(sample_operation):
|
||||||
|
Loading…
Reference in New Issue
Block a user