@@ -167,6 +167,52 @@ public RoutingRuleAction deserialize(JsonParser jp, DeserializationContext ctxt)
167167 log .log (Level .FINER , "Input data does not match schema 'SendTeamsMessageAction'" , e );
168168 }
169169
170+ // deserialize TriggerWorkflowAutomationAction
171+ try {
172+ boolean attemptParsing = true ;
173+ // ensure that we respect type coercion as set on the client ObjectMapper
174+ if (TriggerWorkflowAutomationAction .class .equals (Integer .class )
175+ || TriggerWorkflowAutomationAction .class .equals (Long .class )
176+ || TriggerWorkflowAutomationAction .class .equals (Float .class )
177+ || TriggerWorkflowAutomationAction .class .equals (Double .class )
178+ || TriggerWorkflowAutomationAction .class .equals (Boolean .class )
179+ || TriggerWorkflowAutomationAction .class .equals (String .class )) {
180+ attemptParsing = typeCoercion ;
181+ if (!attemptParsing ) {
182+ attemptParsing |=
183+ ((TriggerWorkflowAutomationAction .class .equals (Integer .class )
184+ || TriggerWorkflowAutomationAction .class .equals (Long .class ))
185+ && token == JsonToken .VALUE_NUMBER_INT );
186+ attemptParsing |=
187+ ((TriggerWorkflowAutomationAction .class .equals (Float .class )
188+ || TriggerWorkflowAutomationAction .class .equals (Double .class ))
189+ && (token == JsonToken .VALUE_NUMBER_FLOAT
190+ || token == JsonToken .VALUE_NUMBER_INT ));
191+ attemptParsing |=
192+ (TriggerWorkflowAutomationAction .class .equals (Boolean .class )
193+ && (token == JsonToken .VALUE_FALSE || token == JsonToken .VALUE_TRUE ));
194+ attemptParsing |=
195+ (TriggerWorkflowAutomationAction .class .equals (String .class )
196+ && token == JsonToken .VALUE_STRING );
197+ }
198+ }
199+ if (attemptParsing ) {
200+ tmp = tree .traverse (jp .getCodec ()).readValueAs (TriggerWorkflowAutomationAction .class );
201+ // TODO: there is no validation against JSON schema constraints
202+ // (min, max, enum, pattern...), this does not perform a strict JSON
203+ // validation, which means the 'match' count may be higher than it should be.
204+ if (!((TriggerWorkflowAutomationAction ) tmp ).unparsed ) {
205+ deserialized = tmp ;
206+ match ++;
207+ }
208+ log .log (Level .FINER , "Input data matches schema 'TriggerWorkflowAutomationAction'" );
209+ }
210+ } catch (Exception e ) {
211+ // deserialization failed, continue
212+ log .log (
213+ Level .FINER , "Input data does not match schema 'TriggerWorkflowAutomationAction'" , e );
214+ }
215+
170216 RoutingRuleAction ret = new RoutingRuleAction ();
171217 if (match == 1 ) {
172218 ret .setActualInstance (deserialized );
@@ -205,9 +251,16 @@ public RoutingRuleAction(SendTeamsMessageAction o) {
205251 setActualInstance (o );
206252 }
207253
254+ public RoutingRuleAction (TriggerWorkflowAutomationAction o ) {
255+ super ("oneOf" , Boolean .FALSE );
256+ setActualInstance (o );
257+ }
258+
208259 static {
209260 schemas .put ("SendSlackMessageAction" , new GenericType <SendSlackMessageAction >() {});
210261 schemas .put ("SendTeamsMessageAction" , new GenericType <SendTeamsMessageAction >() {});
262+ schemas .put (
263+ "TriggerWorkflowAutomationAction" , new GenericType <TriggerWorkflowAutomationAction >() {});
211264 JSON .registerDescendants (RoutingRuleAction .class , Collections .unmodifiableMap (schemas ));
212265 }
213266
@@ -218,7 +271,8 @@ public Map<String, GenericType> getSchemas() {
218271
219272 /**
220273 * Set the instance that matches the oneOf child schema, check the instance parameter is valid
221- * against the oneOf child schemas: SendSlackMessageAction, SendTeamsMessageAction
274+ * against the oneOf child schemas: SendSlackMessageAction, SendTeamsMessageAction,
275+ * TriggerWorkflowAutomationAction
222276 *
223277 * <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
224278 * composed schema (allOf, anyOf, oneOf).
@@ -233,20 +287,27 @@ public void setActualInstance(Object instance) {
233287 super .setActualInstance (instance );
234288 return ;
235289 }
290+ if (JSON .isInstanceOf (
291+ TriggerWorkflowAutomationAction .class , instance , new HashSet <Class <?>>())) {
292+ super .setActualInstance (instance );
293+ return ;
294+ }
236295
237296 if (JSON .isInstanceOf (UnparsedObject .class , instance , new HashSet <Class <?>>())) {
238297 super .setActualInstance (instance );
239298 return ;
240299 }
241300 throw new RuntimeException (
242- "Invalid instance type. Must be SendSlackMessageAction, SendTeamsMessageAction" );
301+ "Invalid instance type. Must be SendSlackMessageAction, SendTeamsMessageAction,"
302+ + " TriggerWorkflowAutomationAction" );
243303 }
244304
245305 /**
246306 * Get the actual instance, which can be the following: SendSlackMessageAction,
247- * SendTeamsMessageAction
307+ * SendTeamsMessageAction, TriggerWorkflowAutomationAction
248308 *
249- * @return The actual instance (SendSlackMessageAction, SendTeamsMessageAction)
309+ * @return The actual instance (SendSlackMessageAction, SendTeamsMessageAction,
310+ * TriggerWorkflowAutomationAction)
250311 */
251312 @ Override
252313 public Object getActualInstance () {
@@ -274,4 +335,16 @@ public SendSlackMessageAction getSendSlackMessageAction() throws ClassCastExcept
274335 public SendTeamsMessageAction getSendTeamsMessageAction () throws ClassCastException {
275336 return (SendTeamsMessageAction ) super .getActualInstance ();
276337 }
338+
339+ /**
340+ * Get the actual instance of `TriggerWorkflowAutomationAction`. If the actual instance is not
341+ * `TriggerWorkflowAutomationAction`, the ClassCastException will be thrown.
342+ *
343+ * @return The actual instance of `TriggerWorkflowAutomationAction`
344+ * @throws ClassCastException if the instance is not `TriggerWorkflowAutomationAction`
345+ */
346+ public TriggerWorkflowAutomationAction getTriggerWorkflowAutomationAction ()
347+ throws ClassCastException {
348+ return (TriggerWorkflowAutomationAction ) super .getActualInstance ();
349+ }
277350}
0 commit comments