@@ -127,6 +127,54 @@ public MonitorNotificationRuleFilter deserialize(JsonParser jp, DeserializationC
127127 Level .FINER , "Input data does not match schema 'MonitorNotificationRuleFilterTags'" , e );
128128 }
129129
130+ // deserialize MonitorNotificationRuleFilterScope
131+ try {
132+ boolean attemptParsing = true ;
133+ // ensure that we respect type coercion as set on the client ObjectMapper
134+ if (MonitorNotificationRuleFilterScope .class .equals (Integer .class )
135+ || MonitorNotificationRuleFilterScope .class .equals (Long .class )
136+ || MonitorNotificationRuleFilterScope .class .equals (Float .class )
137+ || MonitorNotificationRuleFilterScope .class .equals (Double .class )
138+ || MonitorNotificationRuleFilterScope .class .equals (Boolean .class )
139+ || MonitorNotificationRuleFilterScope .class .equals (String .class )) {
140+ attemptParsing = typeCoercion ;
141+ if (!attemptParsing ) {
142+ attemptParsing |=
143+ ((MonitorNotificationRuleFilterScope .class .equals (Integer .class )
144+ || MonitorNotificationRuleFilterScope .class .equals (Long .class ))
145+ && token == JsonToken .VALUE_NUMBER_INT );
146+ attemptParsing |=
147+ ((MonitorNotificationRuleFilterScope .class .equals (Float .class )
148+ || MonitorNotificationRuleFilterScope .class .equals (Double .class ))
149+ && (token == JsonToken .VALUE_NUMBER_FLOAT
150+ || token == JsonToken .VALUE_NUMBER_INT ));
151+ attemptParsing |=
152+ (MonitorNotificationRuleFilterScope .class .equals (Boolean .class )
153+ && (token == JsonToken .VALUE_FALSE || token == JsonToken .VALUE_TRUE ));
154+ attemptParsing |=
155+ (MonitorNotificationRuleFilterScope .class .equals (String .class )
156+ && token == JsonToken .VALUE_STRING );
157+ }
158+ }
159+ if (attemptParsing ) {
160+ tmp = tree .traverse (jp .getCodec ()).readValueAs (MonitorNotificationRuleFilterScope .class );
161+ // TODO: there is no validation against JSON schema constraints
162+ // (min, max, enum, pattern...), this does not perform a strict JSON
163+ // validation, which means the 'match' count may be higher than it should be.
164+ if (!((MonitorNotificationRuleFilterScope ) tmp ).unparsed ) {
165+ deserialized = tmp ;
166+ match ++;
167+ }
168+ log .log (Level .FINER , "Input data matches schema 'MonitorNotificationRuleFilterScope'" );
169+ }
170+ } catch (Exception e ) {
171+ // deserialization failed, continue
172+ log .log (
173+ Level .FINER ,
174+ "Input data does not match schema 'MonitorNotificationRuleFilterScope'" ,
175+ e );
176+ }
177+
130178 MonitorNotificationRuleFilter ret = new MonitorNotificationRuleFilter ();
131179 if (match == 1 ) {
132180 ret .setActualInstance (deserialized );
@@ -162,10 +210,18 @@ public MonitorNotificationRuleFilter(MonitorNotificationRuleFilterTags o) {
162210 setActualInstance (o );
163211 }
164212
213+ public MonitorNotificationRuleFilter (MonitorNotificationRuleFilterScope o ) {
214+ super ("oneOf" , Boolean .FALSE );
215+ setActualInstance (o );
216+ }
217+
165218 static {
166219 schemas .put (
167220 "MonitorNotificationRuleFilterTags" ,
168221 new GenericType <MonitorNotificationRuleFilterTags >() {});
222+ schemas .put (
223+ "MonitorNotificationRuleFilterScope" ,
224+ new GenericType <MonitorNotificationRuleFilterScope >() {});
169225 JSON .registerDescendants (
170226 MonitorNotificationRuleFilter .class , Collections .unmodifiableMap (schemas ));
171227 }
@@ -177,7 +233,8 @@ public Map<String, GenericType> getSchemas() {
177233
178234 /**
179235 * Set the instance that matches the oneOf child schema, check the instance parameter is valid
180- * against the oneOf child schemas: MonitorNotificationRuleFilterTags
236+ * against the oneOf child schemas: MonitorNotificationRuleFilterTags,
237+ * MonitorNotificationRuleFilterScope
181238 *
182239 * <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
183240 * composed schema (allOf, anyOf, oneOf).
@@ -189,18 +246,27 @@ public void setActualInstance(Object instance) {
189246 super .setActualInstance (instance );
190247 return ;
191248 }
249+ if (JSON .isInstanceOf (
250+ MonitorNotificationRuleFilterScope .class , instance , new HashSet <Class <?>>())) {
251+ super .setActualInstance (instance );
252+ return ;
253+ }
192254
193255 if (JSON .isInstanceOf (UnparsedObject .class , instance , new HashSet <Class <?>>())) {
194256 super .setActualInstance (instance );
195257 return ;
196258 }
197- throw new RuntimeException ("Invalid instance type. Must be MonitorNotificationRuleFilterTags" );
259+ throw new RuntimeException (
260+ "Invalid instance type. Must be MonitorNotificationRuleFilterTags,"
261+ + " MonitorNotificationRuleFilterScope" );
198262 }
199263
200264 /**
201- * Get the actual instance, which can be the following: MonitorNotificationRuleFilterTags
265+ * Get the actual instance, which can be the following: MonitorNotificationRuleFilterTags,
266+ * MonitorNotificationRuleFilterScope
202267 *
203- * @return The actual instance (MonitorNotificationRuleFilterTags)
268+ * @return The actual instance (MonitorNotificationRuleFilterTags,
269+ * MonitorNotificationRuleFilterScope)
204270 */
205271 @ Override
206272 public Object getActualInstance () {
@@ -218,4 +284,16 @@ public MonitorNotificationRuleFilterTags getMonitorNotificationRuleFilterTags()
218284 throws ClassCastException {
219285 return (MonitorNotificationRuleFilterTags ) super .getActualInstance ();
220286 }
287+
288+ /**
289+ * Get the actual instance of `MonitorNotificationRuleFilterScope`. If the actual instance is not
290+ * `MonitorNotificationRuleFilterScope`, the ClassCastException will be thrown.
291+ *
292+ * @return The actual instance of `MonitorNotificationRuleFilterScope`
293+ * @throws ClassCastException if the instance is not `MonitorNotificationRuleFilterScope`
294+ */
295+ public MonitorNotificationRuleFilterScope getMonitorNotificationRuleFilterScope ()
296+ throws ClassCastException {
297+ return (MonitorNotificationRuleFilterScope ) super .getActualInstance ();
298+ }
221299}
0 commit comments