diff --git a/rasa_core/nlg/callback.py b/rasa_core/nlg/callback.py index 75083b3f9c3..99fdf05ad5e 100644 --- a/rasa_core/nlg/callback.py +++ b/rasa_core/nlg/callback.py @@ -25,18 +25,18 @@ def nlg_response_format_spec(): "type": "string" }, "buttons": { - "type": "array", + "type": ["array", "null"], "items": {"type": "object"} }, "elements": { - "type": "array", + "type": ["array", "null"], "items": {"type": "object"} }, "attachment": { - "type": "object" + "type": ["object", "null"] }, "image": { - "type": "string" + "type": ["string", "null"] } }, } diff --git a/tests/test_nlg.py b/tests/test_nlg.py index 6cea48b77b7..b40a8bac9ae 100644 --- a/tests/test_nlg.py +++ b/tests/test_nlg.py @@ -79,3 +79,8 @@ def test_nlg_schema_validation(): def test_nlg_schema_validation_empty_buttons(): content = {"text": "Hey there!", "buttons": []} assert CallbackNaturalLanguageGenerator.validate_response(content) + + +def test_nlg_schema_validation_empty_image(): + content = {"text": "Hey there!", "image": None} + assert CallbackNaturalLanguageGenerator.validate_response(content)