@@ -36,6 +36,10 @@ class ListVoicesResponse : public Firebolt::JSON::NL_Json_Basic<::Firebolt::Text
3636public:
3737 void fromJson (const nlohmann::json& json) override
3838 {
39+ if (!checkRequiredFields (json, {" TTS_Status" , " voices" }))
40+ {
41+ throw std::invalid_argument (" Missing required fields in JSON" );
42+ }
3943 ttsStatus_ = json[" TTS_Status" ].get <uint32_t >();
4044 voices_.clear ();
4145 for (const auto & voice : json[" voices" ])
@@ -56,7 +60,14 @@ class ListVoicesResponse : public Firebolt::JSON::NL_Json_Basic<::Firebolt::Text
5660class SpeechIdEvent : public Firebolt ::JSON::NL_Json_Basic<::Firebolt::TextToSpeech::SpeechIdEvent>
5761{
5862public:
59- void fromJson (const nlohmann::json& json) override { speechId_ = json[" speechid" ].get <uint32_t >(); }
63+ void fromJson (const nlohmann::json& json) override
64+ {
65+ if (!checkRequiredFields (json, {" speechid" }))
66+ {
67+ throw std::invalid_argument (" Missing required fields in JSON" );
68+ }
69+ speechId_ = json[" speechid" ].get <uint32_t >();
70+ }
6071 ::Firebolt::TextToSpeech::SpeechIdEvent value () const override
6172 {
6273 return ::Firebolt::TextToSpeech::SpeechIdEvent{speechId_};
@@ -71,6 +82,10 @@ class SpeechResponse : public Firebolt::JSON::NL_Json_Basic<::Firebolt::TextToSp
7182public:
7283 void fromJson (const nlohmann::json& json) override
7384 {
85+ if (!checkRequiredFields (json, {" speechid" , " TTS_Status" , " success" }))
86+ {
87+ throw std::invalid_argument (" Missing required fields in JSON" );
88+ }
7489 speechId_ = json[" speechid" ].get <uint32_t >();
7590 ttsStatus_ = json[" TTS_Status" ].get <uint32_t >();
7691 success_ = json[" success" ].get <bool >();
@@ -91,6 +106,10 @@ class SpeechStateResponse : public Firebolt::JSON::NL_Json_Basic<::Firebolt::Tex
91106public:
92107 void fromJson (const nlohmann::json& json) override
93108 {
109+ if (!checkRequiredFields (json, {" speechstate" , " TTS_Status" , " success" }))
110+ {
111+ throw std::invalid_argument (" Missing required fields in JSON" );
112+ }
94113 speechState_ = static_cast <SpeechState>(json[" speechstate" ].get <uint32_t >());
95114 ttsStatus_ = json[" TTS_Status" ].get <uint32_t >();
96115 success_ = json[" success" ].get <bool >();
@@ -111,6 +130,10 @@ class TTSStatusResponse : public Firebolt::JSON::NL_Json_Basic<::Firebolt::TextT
111130public:
112131 void fromJson (const nlohmann::json& json) override
113132 {
133+ if (!checkRequiredFields (json, {" TTS_Status" , " success" }))
134+ {
135+ throw std::invalid_argument (" Missing required fields in JSON" );
136+ }
114137 ttsStatus_ = json[" TTS_Status" ].get <uint32_t >();
115138 success_ = json[" success" ].get <bool >();
116139 }
0 commit comments