@@ -175,6 +175,51 @@ public IncidentIntegrationMetadataMetadata deserialize(
175175 log .log (Level .FINER , "Input data does not match schema 'JiraIntegrationMetadata'" , e );
176176 }
177177
178+ // deserialize MSTeamsIntegrationMetadata
179+ try {
180+ boolean attemptParsing = true ;
181+ // ensure that we respect type coercion as set on the client ObjectMapper
182+ if (MSTeamsIntegrationMetadata .class .equals (Integer .class )
183+ || MSTeamsIntegrationMetadata .class .equals (Long .class )
184+ || MSTeamsIntegrationMetadata .class .equals (Float .class )
185+ || MSTeamsIntegrationMetadata .class .equals (Double .class )
186+ || MSTeamsIntegrationMetadata .class .equals (Boolean .class )
187+ || MSTeamsIntegrationMetadata .class .equals (String .class )) {
188+ attemptParsing = typeCoercion ;
189+ if (!attemptParsing ) {
190+ attemptParsing |=
191+ ((MSTeamsIntegrationMetadata .class .equals (Integer .class )
192+ || MSTeamsIntegrationMetadata .class .equals (Long .class ))
193+ && token == JsonToken .VALUE_NUMBER_INT );
194+ attemptParsing |=
195+ ((MSTeamsIntegrationMetadata .class .equals (Float .class )
196+ || MSTeamsIntegrationMetadata .class .equals (Double .class ))
197+ && (token == JsonToken .VALUE_NUMBER_FLOAT
198+ || token == JsonToken .VALUE_NUMBER_INT ));
199+ attemptParsing |=
200+ (MSTeamsIntegrationMetadata .class .equals (Boolean .class )
201+ && (token == JsonToken .VALUE_FALSE || token == JsonToken .VALUE_TRUE ));
202+ attemptParsing |=
203+ (MSTeamsIntegrationMetadata .class .equals (String .class )
204+ && token == JsonToken .VALUE_STRING );
205+ }
206+ }
207+ if (attemptParsing ) {
208+ tmp = tree .traverse (jp .getCodec ()).readValueAs (MSTeamsIntegrationMetadata .class );
209+ // TODO: there is no validation against JSON schema constraints
210+ // (min, max, enum, pattern...), this does not perform a strict JSON
211+ // validation, which means the 'match' count may be higher than it should be.
212+ if (!((MSTeamsIntegrationMetadata ) tmp ).unparsed ) {
213+ deserialized = tmp ;
214+ match ++;
215+ }
216+ log .log (Level .FINER , "Input data matches schema 'MSTeamsIntegrationMetadata'" );
217+ }
218+ } catch (Exception e ) {
219+ // deserialization failed, continue
220+ log .log (Level .FINER , "Input data does not match schema 'MSTeamsIntegrationMetadata'" , e );
221+ }
222+
178223 IncidentIntegrationMetadataMetadata ret = new IncidentIntegrationMetadataMetadata ();
179224 if (match == 1 ) {
180225 ret .setActualInstance (deserialized );
@@ -215,9 +260,15 @@ public IncidentIntegrationMetadataMetadata(JiraIntegrationMetadata o) {
215260 setActualInstance (o );
216261 }
217262
263+ public IncidentIntegrationMetadataMetadata (MSTeamsIntegrationMetadata o ) {
264+ super ("oneOf" , Boolean .FALSE );
265+ setActualInstance (o );
266+ }
267+
218268 static {
219269 schemas .put ("SlackIntegrationMetadata" , new GenericType <SlackIntegrationMetadata >() {});
220270 schemas .put ("JiraIntegrationMetadata" , new GenericType <JiraIntegrationMetadata >() {});
271+ schemas .put ("MSTeamsIntegrationMetadata" , new GenericType <MSTeamsIntegrationMetadata >() {});
221272 JSON .registerDescendants (
222273 IncidentIntegrationMetadataMetadata .class , Collections .unmodifiableMap (schemas ));
223274 }
@@ -229,7 +280,8 @@ public Map<String, GenericType> getSchemas() {
229280
230281 /**
231282 * Set the instance that matches the oneOf child schema, check the instance parameter is valid
232- * against the oneOf child schemas: SlackIntegrationMetadata, JiraIntegrationMetadata
283+ * against the oneOf child schemas: SlackIntegrationMetadata, JiraIntegrationMetadata,
284+ * MSTeamsIntegrationMetadata
233285 *
234286 * <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
235287 * composed schema (allOf, anyOf, oneOf).
@@ -244,20 +296,26 @@ public void setActualInstance(Object instance) {
244296 super .setActualInstance (instance );
245297 return ;
246298 }
299+ if (JSON .isInstanceOf (MSTeamsIntegrationMetadata .class , instance , new HashSet <Class <?>>())) {
300+ super .setActualInstance (instance );
301+ return ;
302+ }
247303
248304 if (JSON .isInstanceOf (UnparsedObject .class , instance , new HashSet <Class <?>>())) {
249305 super .setActualInstance (instance );
250306 return ;
251307 }
252308 throw new RuntimeException (
253- "Invalid instance type. Must be SlackIntegrationMetadata, JiraIntegrationMetadata" );
309+ "Invalid instance type. Must be SlackIntegrationMetadata, JiraIntegrationMetadata,"
310+ + " MSTeamsIntegrationMetadata" );
254311 }
255312
256313 /**
257314 * Get the actual instance, which can be the following: SlackIntegrationMetadata,
258- * JiraIntegrationMetadata
315+ * JiraIntegrationMetadata, MSTeamsIntegrationMetadata
259316 *
260- * @return The actual instance (SlackIntegrationMetadata, JiraIntegrationMetadata)
317+ * @return The actual instance (SlackIntegrationMetadata, JiraIntegrationMetadata,
318+ * MSTeamsIntegrationMetadata)
261319 */
262320 @ Override
263321 public Object getActualInstance () {
@@ -285,4 +343,15 @@ public SlackIntegrationMetadata getSlackIntegrationMetadata() throws ClassCastEx
285343 public JiraIntegrationMetadata getJiraIntegrationMetadata () throws ClassCastException {
286344 return (JiraIntegrationMetadata ) super .getActualInstance ();
287345 }
346+
347+ /**
348+ * Get the actual instance of `MSTeamsIntegrationMetadata`. If the actual instance is not
349+ * `MSTeamsIntegrationMetadata`, the ClassCastException will be thrown.
350+ *
351+ * @return The actual instance of `MSTeamsIntegrationMetadata`
352+ * @throws ClassCastException if the instance is not `MSTeamsIntegrationMetadata`
353+ */
354+ public MSTeamsIntegrationMetadata getMSTeamsIntegrationMetadata () throws ClassCastException {
355+ return (MSTeamsIntegrationMetadata ) super .getActualInstance ();
356+ }
288357}
0 commit comments