@@ -349,6 +349,51 @@ public SyntheticsBasicAuth deserialize(JsonParser jp, DeserializationContext ctx
349349 log .log (Level .FINER , "Input data does not match schema 'SyntheticsBasicAuthOauthROP'" , e );
350350 }
351351
352+ // deserialize SyntheticsBasicAuthJWT
353+ try {
354+ boolean attemptParsing = true ;
355+ // ensure that we respect type coercion as set on the client ObjectMapper
356+ if (SyntheticsBasicAuthJWT .class .equals (Integer .class )
357+ || SyntheticsBasicAuthJWT .class .equals (Long .class )
358+ || SyntheticsBasicAuthJWT .class .equals (Float .class )
359+ || SyntheticsBasicAuthJWT .class .equals (Double .class )
360+ || SyntheticsBasicAuthJWT .class .equals (Boolean .class )
361+ || SyntheticsBasicAuthJWT .class .equals (String .class )) {
362+ attemptParsing = typeCoercion ;
363+ if (!attemptParsing ) {
364+ attemptParsing |=
365+ ((SyntheticsBasicAuthJWT .class .equals (Integer .class )
366+ || SyntheticsBasicAuthJWT .class .equals (Long .class ))
367+ && token == JsonToken .VALUE_NUMBER_INT );
368+ attemptParsing |=
369+ ((SyntheticsBasicAuthJWT .class .equals (Float .class )
370+ || SyntheticsBasicAuthJWT .class .equals (Double .class ))
371+ && (token == JsonToken .VALUE_NUMBER_FLOAT
372+ || token == JsonToken .VALUE_NUMBER_INT ));
373+ attemptParsing |=
374+ (SyntheticsBasicAuthJWT .class .equals (Boolean .class )
375+ && (token == JsonToken .VALUE_FALSE || token == JsonToken .VALUE_TRUE ));
376+ attemptParsing |=
377+ (SyntheticsBasicAuthJWT .class .equals (String .class )
378+ && token == JsonToken .VALUE_STRING );
379+ }
380+ }
381+ if (attemptParsing ) {
382+ tmp = tree .traverse (jp .getCodec ()).readValueAs (SyntheticsBasicAuthJWT .class );
383+ // TODO: there is no validation against JSON schema constraints
384+ // (min, max, enum, pattern...), this does not perform a strict JSON
385+ // validation, which means the 'match' count may be higher than it should be.
386+ if (!((SyntheticsBasicAuthJWT ) tmp ).unparsed ) {
387+ deserialized = tmp ;
388+ match ++;
389+ }
390+ log .log (Level .FINER , "Input data matches schema 'SyntheticsBasicAuthJWT'" );
391+ }
392+ } catch (Exception e ) {
393+ // deserialization failed, continue
394+ log .log (Level .FINER , "Input data does not match schema 'SyntheticsBasicAuthJWT'" , e );
395+ }
396+
352397 SyntheticsBasicAuth ret = new SyntheticsBasicAuth ();
353398 if (match == 1 ) {
354399 ret .setActualInstance (deserialized );
@@ -408,6 +453,11 @@ public SyntheticsBasicAuth(SyntheticsBasicAuthOauthROP o) {
408453 setActualInstance (o );
409454 }
410455
456+ public SyntheticsBasicAuth (SyntheticsBasicAuthJWT o ) {
457+ super ("oneOf" , Boolean .FALSE );
458+ setActualInstance (o );
459+ }
460+
411461 static {
412462 schemas .put ("SyntheticsBasicAuthWeb" , new GenericType <SyntheticsBasicAuthWeb >() {});
413463 schemas .put ("SyntheticsBasicAuthSigv4" , new GenericType <SyntheticsBasicAuthSigv4 >() {});
@@ -416,6 +466,7 @@ public SyntheticsBasicAuth(SyntheticsBasicAuthOauthROP o) {
416466 schemas .put (
417467 "SyntheticsBasicAuthOauthClient" , new GenericType <SyntheticsBasicAuthOauthClient >() {});
418468 schemas .put ("SyntheticsBasicAuthOauthROP" , new GenericType <SyntheticsBasicAuthOauthROP >() {});
469+ schemas .put ("SyntheticsBasicAuthJWT" , new GenericType <SyntheticsBasicAuthJWT >() {});
419470 JSON .registerDescendants (SyntheticsBasicAuth .class , Collections .unmodifiableMap (schemas ));
420471 }
421472
@@ -428,7 +479,7 @@ public Map<String, GenericType> getSchemas() {
428479 * Set the instance that matches the oneOf child schema, check the instance parameter is valid
429480 * against the oneOf child schemas: SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4,
430481 * SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient,
431- * SyntheticsBasicAuthOauthROP
482+ * SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT
432483 *
433484 * <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
434485 * composed schema (allOf, anyOf, oneOf).
@@ -460,6 +511,10 @@ public void setActualInstance(Object instance) {
460511 super .setActualInstance (instance );
461512 return ;
462513 }
514+ if (JSON .isInstanceOf (SyntheticsBasicAuthJWT .class , instance , new HashSet <Class <?>>())) {
515+ super .setActualInstance (instance );
516+ return ;
517+ }
463518
464519 if (JSON .isInstanceOf (UnparsedObject .class , instance , new HashSet <Class <?>>())) {
465520 super .setActualInstance (instance );
@@ -468,17 +523,17 @@ public void setActualInstance(Object instance) {
468523 throw new RuntimeException (
469524 "Invalid instance type. Must be SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4,"
470525 + " SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient,"
471- + " SyntheticsBasicAuthOauthROP" );
526+ + " SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT " );
472527 }
473528
474529 /**
475530 * Get the actual instance, which can be the following: SyntheticsBasicAuthWeb,
476531 * SyntheticsBasicAuthSigv4, SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest,
477- * SyntheticsBasicAuthOauthClient, SyntheticsBasicAuthOauthROP
532+ * SyntheticsBasicAuthOauthClient, SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT
478533 *
479534 * @return The actual instance (SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4,
480535 * SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient,
481- * SyntheticsBasicAuthOauthROP)
536+ * SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT )
482537 */
483538 @ Override
484539 public Object getActualInstance () {
@@ -551,4 +606,15 @@ public SyntheticsBasicAuthOauthClient getSyntheticsBasicAuthOauthClient()
551606 public SyntheticsBasicAuthOauthROP getSyntheticsBasicAuthOauthROP () throws ClassCastException {
552607 return (SyntheticsBasicAuthOauthROP ) super .getActualInstance ();
553608 }
609+
610+ /**
611+ * Get the actual instance of `SyntheticsBasicAuthJWT`. If the actual instance is not
612+ * `SyntheticsBasicAuthJWT`, the ClassCastException will be thrown.
613+ *
614+ * @return The actual instance of `SyntheticsBasicAuthJWT`
615+ * @throws ClassCastException if the instance is not `SyntheticsBasicAuthJWT`
616+ */
617+ public SyntheticsBasicAuthJWT getSyntheticsBasicAuthJWT () throws ClassCastException {
618+ return (SyntheticsBasicAuthJWT ) super .getActualInstance ();
619+ }
554620}
0 commit comments