Skip to content

Commit 7061257

Browse files
fix(client): deserialization of empty objects
1 parent 4d388dd commit 7061257

29 files changed

Lines changed: 144 additions & 0 deletions

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/models/References.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import org.onebusaway.core.toImmutable
2121
import org.onebusaway.errors.OnebusawaySdkInvalidDataException
2222

2323
class References
24+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2425
private constructor(
2526
private val agencies: JsonField<List<Agency>>,
2627
private val routes: JsonField<List<Route>>,
@@ -414,6 +415,7 @@ private constructor(
414415
(trips.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
415416

416417
class Agency
418+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
417419
private constructor(
418420
private val id: JsonField<String>,
419421
private val name: JsonField<String>,
@@ -905,6 +907,7 @@ private constructor(
905907
}
906908

907909
class Route
910+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
908911
private constructor(
909912
private val id: JsonField<String>,
910913
private val agencyId: JsonField<String>,
@@ -1403,6 +1406,7 @@ private constructor(
14031406
}
14041407

14051408
class Situation
1409+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
14061410
private constructor(
14071411
private val id: JsonField<String>,
14081412
private val creationTime: JsonField<Long>,
@@ -2018,6 +2022,7 @@ private constructor(
20182022
(url.asKnown().getOrNull()?.validity() ?: 0)
20192023

20202024
class ActiveWindow
2025+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
20212026
private constructor(
20222027
private val from: JsonField<Long>,
20232028
private val to: JsonField<Long>,
@@ -2197,6 +2202,7 @@ private constructor(
21972202
}
21982203

21992204
class AllAffect
2205+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
22002206
private constructor(
22012207
private val agencyId: JsonField<String>,
22022208
private val applicationId: JsonField<String>,
@@ -2553,6 +2559,7 @@ private constructor(
25532559
}
25542560

25552561
class Consequence
2562+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
25562563
private constructor(
25572564
private val condition: JsonField<String>,
25582565
private val conditionDetails: JsonField<ConditionDetails>,
@@ -2725,6 +2732,7 @@ private constructor(
27252732
(conditionDetails.asKnown().getOrNull()?.validity() ?: 0)
27262733

27272734
class ConditionDetails
2735+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
27282736
private constructor(
27292737
private val diversionPath: JsonField<DiversionPath>,
27302738
private val diversionStopIds: JsonField<List<String>>,
@@ -2917,6 +2925,7 @@ private constructor(
29172925
(diversionStopIds.asKnown().getOrNull()?.size ?: 0)
29182926

29192927
class DiversionPath
2928+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
29202929
private constructor(
29212930
private val length: JsonField<Long>,
29222931
private val levels: JsonField<String>,
@@ -3197,6 +3206,7 @@ private constructor(
31973206
}
31983207

31993208
class Description
3209+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
32003210
private constructor(
32013211
private val lang: JsonField<String>,
32023212
private val value: JsonField<String>,
@@ -3376,6 +3386,7 @@ private constructor(
33763386
}
33773387

33783388
class PublicationWindow
3389+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
33793390
private constructor(
33803391
private val from: JsonField<Long>,
33813392
private val to: JsonField<Long>,
@@ -3725,6 +3736,7 @@ private constructor(
37253736
}
37263737

37273738
class Summary
3739+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
37283740
private constructor(
37293741
private val lang: JsonField<String>,
37303742
private val value: JsonField<String>,
@@ -3903,6 +3915,7 @@ private constructor(
39033915
}
39043916

39053917
class Url
3918+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
39063919
private constructor(
39073920
private val lang: JsonField<String>,
39083921
private val value: JsonField<String>,
@@ -4126,6 +4139,7 @@ private constructor(
41264139
}
41274140

41284141
class Stop
4142+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
41294143
private constructor(
41304144
private val id: JsonField<String>,
41314145
private val lat: JsonField<Double>,
@@ -4701,6 +4715,7 @@ private constructor(
47014715
}
47024716

47034717
class StopTime
4718+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
47044719
private constructor(
47054720
private val arrivalTime: JsonField<Long>,
47064721
private val departureTime: JsonField<Long>,
@@ -5058,6 +5073,7 @@ private constructor(
50585073
}
50595074

50605075
class Trip
5076+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
50615077
private constructor(
50625078
private val id: JsonField<String>,
50635079
private val routeId: JsonField<String>,

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/models/ResponseWrapper.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import org.onebusaway.core.checkRequired
1616
import org.onebusaway.errors.OnebusawaySdkInvalidDataException
1717

1818
class ResponseWrapper
19+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
1920
private constructor(
2021
private val code: JsonField<Long>,
2122
private val currentTime: JsonField<Long>,

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/models/agencieswithcoverage/AgenciesWithCoverageListResponse.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import org.onebusaway.models.References
2121
import org.onebusaway.models.ResponseWrapper
2222

2323
class AgenciesWithCoverageListResponse
24+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2425
private constructor(
2526
private val code: JsonField<Long>,
2627
private val currentTime: JsonField<Long>,
@@ -300,6 +301,7 @@ private constructor(
300301
(data.asKnown().getOrNull()?.validity() ?: 0)
301302

302303
class Data
304+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
303305
private constructor(
304306
private val limitExceeded: JsonField<Boolean>,
305307
private val list: JsonField<kotlin.collections.List<List>>,
@@ -536,6 +538,7 @@ private constructor(
536538
(references.asKnown().getOrNull()?.validity() ?: 0)
537539

538540
class List
541+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
539542
private constructor(
540543
private val agencyId: JsonField<String>,
541544
private val lat: JsonField<Double>,

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/models/agency/AgencyRetrieveResponse.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import org.onebusaway.models.References
2020
import org.onebusaway.models.ResponseWrapper
2121

2222
class AgencyRetrieveResponse
23+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2324
private constructor(
2425
private val code: JsonField<Long>,
2526
private val currentTime: JsonField<Long>,
@@ -296,6 +297,7 @@ private constructor(
296297
(data.asKnown().getOrNull()?.validity() ?: 0)
297298

298299
class Data
300+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
299301
private constructor(
300302
private val entry: JsonField<Entry>,
301303
private val limitExceeded: JsonField<Boolean>,
@@ -514,6 +516,7 @@ private constructor(
514516
(references.asKnown().getOrNull()?.validity() ?: 0)
515517

516518
class Entry
519+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
517520
private constructor(
518521
private val id: JsonField<String>,
519522
private val name: JsonField<String>,

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/models/arrivalanddeparture/ArrivalAndDepartureListResponse.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import org.onebusaway.models.References
2222
import org.onebusaway.models.ResponseWrapper
2323

2424
class ArrivalAndDepartureListResponse
25+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2526
private constructor(
2627
private val code: JsonField<Long>,
2728
private val currentTime: JsonField<Long>,
@@ -301,6 +302,7 @@ private constructor(
301302
(data.asKnown().getOrNull()?.validity() ?: 0)
302303

303304
class Data
305+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
304306
private constructor(
305307
private val entry: JsonField<Entry>,
306308
private val references: JsonField<References>,
@@ -479,6 +481,7 @@ private constructor(
479481
(references.asKnown().getOrNull()?.validity() ?: 0)
480482

481483
class Entry
484+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
482485
private constructor(
483486
private val arrivalsAndDepartures: JsonField<List<ArrivalsAndDeparture>>,
484487
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -649,6 +652,7 @@ private constructor(
649652
(arrivalsAndDepartures.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
650653

651654
class ArrivalsAndDeparture
655+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
652656
private constructor(
653657
private val arrivalEnabled: JsonField<Boolean>,
654658
private val blockTripSequence: JsonField<Long>,
@@ -2311,6 +2315,7 @@ private constructor(
23112315

23122316
/** Trip-specific status for the arriving transit vehicle. */
23132317
class TripStatus
2318+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
23142319
private constructor(
23152320
private val activeTripId: JsonField<String>,
23162321
private val blockTripSequence: JsonField<Long>,
@@ -3699,6 +3704,7 @@ private constructor(
36993704

37003705
/** Last known location of the transit vehicle. */
37013706
class LastKnownLocation
3707+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
37023708
private constructor(
37033709
private val lat: JsonField<Double>,
37043710
private val lon: JsonField<Double>,
@@ -3896,6 +3902,7 @@ private constructor(
38963902

38973903
/** Current position of the transit vehicle. */
38983904
class Position
3905+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
38993906
private constructor(
39003907
private val lat: JsonField<Double>,
39013908
private val lon: JsonField<Double>,

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/models/arrivalanddeparture/ArrivalAndDepartureRetrieveResponse.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import org.onebusaway.models.References
2222
import org.onebusaway.models.ResponseWrapper
2323

2424
class ArrivalAndDepartureRetrieveResponse
25+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2526
private constructor(
2627
private val code: JsonField<Long>,
2728
private val currentTime: JsonField<Long>,
@@ -302,6 +303,7 @@ private constructor(
302303
(data.asKnown().getOrNull()?.validity() ?: 0)
303304

304305
class Data
306+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
305307
private constructor(
306308
private val entry: JsonField<Entry>,
307309
private val references: JsonField<References>,
@@ -480,6 +482,7 @@ private constructor(
480482
(references.asKnown().getOrNull()?.validity() ?: 0)
481483

482484
class Entry
485+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
483486
private constructor(
484487
private val arrivalEnabled: JsonField<Boolean>,
485488
private val blockTripSequence: JsonField<Long>,
@@ -2120,6 +2123,7 @@ private constructor(
21202123

21212124
/** Trip-specific status for the arriving transit vehicle. */
21222125
class TripStatus
2126+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
21232127
private constructor(
21242128
private val activeTripId: JsonField<String>,
21252129
private val blockTripSequence: JsonField<Long>,
@@ -3473,6 +3477,7 @@ private constructor(
34733477

34743478
/** Last known location of the transit vehicle. */
34753479
class LastKnownLocation
3480+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
34763481
private constructor(
34773482
private val lat: JsonField<Double>,
34783483
private val lon: JsonField<Double>,
@@ -3667,6 +3672,7 @@ private constructor(
36673672

36683673
/** Current position of the transit vehicle. */
36693674
class Position
3675+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
36703676
private constructor(
36713677
private val lat: JsonField<Double>,
36723678
private val lon: JsonField<Double>,

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/models/block/BlockRetrieveResponse.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import org.onebusaway.models.References
2222
import org.onebusaway.models.ResponseWrapper
2323

2424
class BlockRetrieveResponse
25+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2526
private constructor(
2627
private val code: JsonField<Long>,
2728
private val currentTime: JsonField<Long>,
@@ -298,6 +299,7 @@ private constructor(
298299
(data.asKnown().getOrNull()?.validity() ?: 0)
299300

300301
class Data
302+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
301303
private constructor(
302304
private val entry: JsonField<Entry>,
303305
private val references: JsonField<References>,
@@ -476,6 +478,7 @@ private constructor(
476478
(references.asKnown().getOrNull()?.validity() ?: 0)
477479

478480
class Entry
481+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
479482
private constructor(
480483
private val id: JsonField<String>,
481484
private val configurations: JsonField<List<Configuration>>,
@@ -673,6 +676,7 @@ private constructor(
673676
(configurations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
674677

675678
class Configuration
679+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
676680
private constructor(
677681
private val activeServiceIds: JsonField<List<String>>,
678682
private val trips: JsonField<List<Trip>>,
@@ -943,6 +947,7 @@ private constructor(
943947
(inactiveServiceIds.asKnown().getOrNull()?.size ?: 0)
944948

945949
class Trip
950+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
946951
private constructor(
947952
private val accumulatedSlackTime: JsonField<Float>,
948953
private val blockStopTimes: JsonField<List<BlockStopTime>>,
@@ -1243,6 +1248,7 @@ private constructor(
12431248
(if (tripId.asKnown().isPresent) 1 else 0)
12441249

12451250
class BlockStopTime
1251+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
12461252
private constructor(
12471253
private val accumulatedSlackTime: JsonField<Float>,
12481254
private val blockSequence: JsonField<Long>,
@@ -1532,6 +1538,7 @@ private constructor(
15321538
(stopTime.asKnown().getOrNull()?.validity() ?: 0)
15331539

15341540
class StopTime
1541+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
15351542
private constructor(
15361543
private val arrivalTime: JsonField<Long>,
15371544
private val departureTime: JsonField<Long>,

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/models/config/ConfigRetrieveResponse.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import org.onebusaway.models.References
2020
import org.onebusaway.models.ResponseWrapper
2121

2222
class ConfigRetrieveResponse
23+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2324
private constructor(
2425
private val code: JsonField<Long>,
2526
private val currentTime: JsonField<Long>,
@@ -296,6 +297,7 @@ private constructor(
296297
(data.asKnown().getOrNull()?.validity() ?: 0)
297298

298299
class Data
300+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
299301
private constructor(
300302
private val entry: JsonField<Entry>,
301303
private val references: JsonField<References>,
@@ -474,6 +476,7 @@ private constructor(
474476
(references.asKnown().getOrNull()?.validity() ?: 0)
475477

476478
class Entry
479+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
477480
private constructor(
478481
private val id: JsonField<String>,
479482
private val gitProperties: JsonField<GitProperties>,
@@ -751,6 +754,7 @@ private constructor(
751754
(if (serviceDateTo.asKnown().isPresent) 1 else 0)
752755

753756
class GitProperties
757+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
754758
private constructor(
755759
private val gitBranch: JsonField<String>,
756760
private val gitBuildHost: JsonField<String>,

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/models/currenttime/CurrentTimeRetrieveResponse.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import org.onebusaway.models.References
2020
import org.onebusaway.models.ResponseWrapper
2121

2222
class CurrentTimeRetrieveResponse
23+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2324
private constructor(
2425
private val code: JsonField<Long>,
2526
private val currentTime: JsonField<Long>,
@@ -296,6 +297,7 @@ private constructor(
296297
(data.asKnown().getOrNull()?.validity() ?: 0)
297298

298299
class Data
300+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
299301
private constructor(
300302
private val entry: JsonField<Entry>,
301303
private val references: JsonField<References>,
@@ -474,6 +476,7 @@ private constructor(
474476
(references.asKnown().getOrNull()?.validity() ?: 0)
475477

476478
class Entry
479+
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
477480
private constructor(
478481
private val readableTime: JsonField<String>,
479482
private val time: JsonField<Long>,

0 commit comments

Comments
 (0)