@@ -346,8 +346,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
346
346
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
347
347
* @throws IOException If an error occurs while reading the BatchJobScheduleStatistics.
348
348
*/
349
- @ Generated
350
349
public static BatchJobScheduleStatistics fromJson (JsonReader jsonReader ) throws IOException {
350
+ // TODO: Re-add @Generated tag here and re-generate SDK once the 2024-05-01 Batch Service API is released
351
351
return jsonReader .readObject (reader -> {
352
352
String url = null ;
353
353
OffsetDateTime startTime = null ;
@@ -381,19 +381,78 @@ public static BatchJobScheduleStatistics fromJson(JsonReader jsonReader) throws
381
381
} else if ("wallClockTime" .equals (fieldName )) {
382
382
wallClockTime = reader .getNullable (nonNullReader -> Duration .parse (nonNullReader .getString ()));
383
383
} else if ("readIOps" .equals (fieldName )) {
384
- readIOps = reader .getLong ();
384
+ if (reader .currentToken () == JsonToken .STRING ) {
385
+ String readIOpsStr = reader .getString ();
386
+ try {
387
+ readIOps = Long .parseLong (readIOpsStr );
388
+ } catch (NumberFormatException e ) {
389
+ throw new IOException ("Expected numeric readIOps, but found: " + readIOpsStr , e );
390
+ }
391
+ } else if (reader .currentToken () == JsonToken .NUMBER ) {
392
+ readIOps = reader .getLong ();
393
+ } else {
394
+ throw new IOException ("Expected readIOps to be a number or string, but found other type" );
395
+ }
385
396
} else if ("writeIOps" .equals (fieldName )) {
386
- writeIOps = reader .getLong ();
397
+ if (reader .currentToken () == JsonToken .STRING ) {
398
+ String writeIOpsStr = reader .getString ();
399
+ try {
400
+ writeIOps = Long .parseLong (writeIOpsStr );
401
+ } catch (NumberFormatException e ) {
402
+ throw new IOException ("Expected numeric writeIOps, but found: " + writeIOpsStr , e );
403
+ }
404
+ } else if (reader .currentToken () == JsonToken .NUMBER ) {
405
+ writeIOps = reader .getLong ();
406
+ } else {
407
+ throw new IOException ("Expected writeIOps to be a number or string, but found other type" );
408
+ }
387
409
} else if ("readIOGiB" .equals (fieldName )) {
388
410
readIOGiB = reader .getDouble ();
389
411
} else if ("writeIOGiB" .equals (fieldName )) {
390
412
writeIOGiB = reader .getDouble ();
391
413
} else if ("numSucceededTasks" .equals (fieldName )) {
392
- numSucceededTasks = reader .getLong ();
414
+ if (reader .currentToken () == JsonToken .STRING ) {
415
+ String numSucceededTasksStr = reader .getString ();
416
+ try {
417
+ numSucceededTasks = Long .parseLong (numSucceededTasksStr );
418
+ } catch (NumberFormatException e ) {
419
+ throw new IOException (
420
+ "Expected numeric numSucceededTasks, but found: " + numSucceededTasksStr , e );
421
+ }
422
+ } else if (reader .currentToken () == JsonToken .NUMBER ) {
423
+ numSucceededTasks = reader .getLong ();
424
+ } else {
425
+ throw new IOException (
426
+ "Expected numSucceededTasks to be a number or string, but found other type" );
427
+ }
393
428
} else if ("numFailedTasks" .equals (fieldName )) {
394
- numFailedTasks = reader .getLong ();
429
+ if (reader .currentToken () == JsonToken .STRING ) {
430
+ String numFailedTasksStr = reader .getString ();
431
+ try {
432
+ numFailedTasks = Long .parseLong (numFailedTasksStr );
433
+ } catch (NumberFormatException e ) {
434
+ throw new IOException ("Expected numeric numFailedTasks, but found: " + numFailedTasksStr ,
435
+ e );
436
+ }
437
+ } else if (reader .currentToken () == JsonToken .NUMBER ) {
438
+ numFailedTasks = reader .getLong ();
439
+ } else {
440
+ throw new IOException ("Expected numFailedTasks to be a number or string, but found other type" );
441
+ }
395
442
} else if ("numTaskRetries" .equals (fieldName )) {
396
- numTaskRetries = reader .getLong ();
443
+ if (reader .currentToken () == JsonToken .STRING ) {
444
+ String numTaskRetriesStr = reader .getString ();
445
+ try {
446
+ numTaskRetries = Long .parseLong (numTaskRetriesStr );
447
+ } catch (NumberFormatException e ) {
448
+ throw new IOException ("Expected numeric numTaskRetries, but found: " + numTaskRetriesStr ,
449
+ e );
450
+ }
451
+ } else if (reader .currentToken () == JsonToken .NUMBER ) {
452
+ numTaskRetries = reader .getLong ();
453
+ } else {
454
+ throw new IOException ("Expected numTaskRetries to be a number or string, but found other type" );
455
+ }
397
456
} else if ("waitTime" .equals (fieldName )) {
398
457
waitTime = reader .getNullable (nonNullReader -> Duration .parse (nonNullReader .getString ()));
399
458
} else {
0 commit comments