Skip to content

Commit 746bf4a

Browse files
docs: clarify forwards compat behavior
1 parent 1ccf96d commit 746bf4a

348 files changed

Lines changed: 10903 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,9 @@ In rare cases, the API may return a response that doesn't match the expected typ
751751

752752
By default, the SDK will not throw an exception in this case. It will throw [`LithicInvalidDataException`](lithic-java-core/src/main/kotlin/com/lithic/api/errors/LithicInvalidDataException.kt) only if you directly access the property.
753753

754-
If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:
754+
Validating the response is _not_ forwards compatible with new types from the API for existing fields.
755+
756+
If you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`:
755757

756758
```java
757759
import com.lithic.api.models.Card;

lithic-java-client-okhttp/src/main/kotlin/com/lithic/api/client/okhttp/LithicOkHttpClient.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ class LithicOkHttpClient private constructor() {
236236
/**
237237
* Whether to call `validate` on every response before returning it.
238238
*
239+
* Setting this to `true` is _not_ forwards compatible with new types from the API for
240+
* existing fields.
241+
*
239242
* Defaults to false, which means the shape of the response will not be validated upfront.
240243
* Instead, validation will only occur for the parts of the response that are accessed.
241244
*/

lithic-java-client-okhttp/src/main/kotlin/com/lithic/api/client/okhttp/LithicOkHttpClientAsync.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ class LithicOkHttpClientAsync private constructor() {
236236
/**
237237
* Whether to call `validate` on every response before returning it.
238238
*
239+
* Setting this to `true` is _not_ forwards compatible with new types from the API for
240+
* existing fields.
241+
*
239242
* Defaults to false, which means the shape of the response will not be validated upfront.
240243
* Instead, validation will only occur for the parts of the response that are accessed.
241244
*/

lithic-java-core/src/main/kotlin/com/lithic/api/core/ClientOptions.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ private constructor(
8080
/**
8181
* Whether to call `validate` on every response before returning it.
8282
*
83+
* Setting this to `true` is _not_ forwards compatible with new types from the API for existing
84+
* fields.
85+
*
8386
* Defaults to false, which means the shape of the response will not be validated upfront.
8487
* Instead, validation will only occur for the parts of the response that are accessed.
8588
*/
@@ -275,6 +278,9 @@ private constructor(
275278
/**
276279
* Whether to call `validate` on every response before returning it.
277280
*
281+
* Setting this to `true` is _not_ forwards compatible with new types from the API for
282+
* existing fields.
283+
*
278284
* Defaults to false, which means the shape of the response will not be validated upfront.
279285
* Instead, validation will only occur for the parts of the response that are accessed.
280286
*/

lithic-java-core/src/main/kotlin/com/lithic/api/core/RequestOptions.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ class RequestOptions private constructor(val responseValidation: Boolean?, val t
3333
private var responseValidation: Boolean? = null
3434
private var timeout: Timeout? = null
3535

36+
/**
37+
* Whether to call `validate` on the response before returning it.
38+
*
39+
* Setting this to `true` is _not_ forwards compatible with new types from the API for
40+
* existing fields.
41+
*
42+
* Defaults to false, which means the shape of the response will not be validated upfront.
43+
* Instead, validation will only occur for the parts of the response that are accessed.
44+
*/
3645
fun responseValidation(responseValidation: Boolean) = apply {
3746
this.responseValidation = responseValidation
3847
}

lithic-java-core/src/main/kotlin/com/lithic/api/models/Account.kt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,14 @@ private constructor(
586586

587587
private var validated: Boolean = false
588588

589+
/**
590+
* Validates that the types of all values in this object match their expected types recursively.
591+
*
592+
* This method is _not_ forwards compatible with new types from the API for existing fields.
593+
*
594+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
595+
* expected type.
596+
*/
589597
fun validate(): Account = apply {
590598
if (validated) {
591599
return@apply
@@ -820,6 +828,15 @@ private constructor(
820828

821829
private var validated: Boolean = false
822830

831+
/**
832+
* Validates that the types of all values in this object match their expected types
833+
* recursively.
834+
*
835+
* This method is _not_ forwards compatible with new types from the API for existing fields.
836+
*
837+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
838+
* expected type.
839+
*/
823840
fun validate(): SpendLimit = apply {
824841
if (validated) {
825842
return@apply
@@ -977,6 +994,15 @@ private constructor(
977994

978995
private var validated: Boolean = false
979996

997+
/**
998+
* Validates that the types of all values in this object match their expected types
999+
* recursively.
1000+
*
1001+
* This method is _not_ forwards compatible with new types from the API for existing fields.
1002+
*
1003+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
1004+
* expected type.
1005+
*/
9801006
fun validate(): State = apply {
9811007
if (validated) {
9821008
return@apply
@@ -1254,6 +1280,15 @@ private constructor(
12541280

12551281
private var validated: Boolean = false
12561282

1283+
/**
1284+
* Validates that the types of all values in this object match their expected types
1285+
* recursively.
1286+
*
1287+
* This method is _not_ forwards compatible with new types from the API for existing fields.
1288+
*
1289+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
1290+
* expected type.
1291+
*/
12571292
fun validate(): AccountHolder = apply {
12581293
if (validated) {
12591294
return@apply
@@ -1461,6 +1496,15 @@ private constructor(
14611496

14621497
private var validated: Boolean = false
14631498

1499+
/**
1500+
* Validates that the types of all values in this object match their expected types
1501+
* recursively.
1502+
*
1503+
* This method is _not_ forwards compatible with new types from the API for existing fields.
1504+
*
1505+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
1506+
* expected type.
1507+
*/
14641508
fun validate(): Substatus = apply {
14651509
if (validated) {
14661510
return@apply
@@ -1799,6 +1843,15 @@ private constructor(
17991843

18001844
private var validated: Boolean = false
18011845

1846+
/**
1847+
* Validates that the types of all values in this object match their expected types
1848+
* recursively.
1849+
*
1850+
* This method is _not_ forwards compatible with new types from the API for existing fields.
1851+
*
1852+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
1853+
* expected type.
1854+
*/
18021855
fun validate(): VerificationAddress = apply {
18031856
if (validated) {
18041857
return@apply

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageResponse.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ private constructor(
218218

219219
private var validated: Boolean = false
220220

221+
/**
222+
* Validates that the types of all values in this object match their expected types recursively.
223+
*
224+
* This method is _not_ forwards compatible with new types from the API for existing fields.
225+
*
226+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
227+
* expected type.
228+
*/
221229
fun validate(): AccountActivityListPageResponse = apply {
222230
if (validated) {
223231
return@apply

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,15 @@ private constructor(
582582

583583
private var validated: Boolean = false
584584

585+
/**
586+
* Validates that the types of all values in this object match their expected types
587+
* recursively.
588+
*
589+
* This method is _not_ forwards compatible with new types from the API for existing fields.
590+
*
591+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
592+
* expected type.
593+
*/
585594
fun validate(): TransactionCategory = apply {
586595
if (validated) {
587596
return@apply
@@ -708,6 +717,15 @@ private constructor(
708717

709718
private var validated: Boolean = false
710719

720+
/**
721+
* Validates that the types of all values in this object match their expected types
722+
* recursively.
723+
*
724+
* This method is _not_ forwards compatible with new types from the API for existing fields.
725+
*
726+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
727+
* expected type.
728+
*/
711729
fun validate(): Result = apply {
712730
if (validated) {
713731
return@apply
@@ -864,6 +882,15 @@ private constructor(
864882

865883
private var validated: Boolean = false
866884

885+
/**
886+
* Validates that the types of all values in this object match their expected types
887+
* recursively.
888+
*
889+
* This method is _not_ forwards compatible with new types from the API for existing fields.
890+
*
891+
* @throws LithicInvalidDataException if any value type in this object doesn't match its
892+
* expected type.
893+
*/
867894
fun validate(): Status = apply {
868895
if (validated) {
869896
return@apply

0 commit comments

Comments
 (0)