Skip to content

Commit d8035d8

Browse files
docs: clarify forwards compat behavior
1 parent b045b8e commit d8035d8

53 files changed

Lines changed: 4939 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
@@ -661,7 +661,9 @@ In rare cases, the API may return a response that doesn't match the expected typ
661661

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

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

666668
```java
667669
import com.openlayer.api.models.inferencepipelines.data.DataStreamResponse;

openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ class OpenlayerOkHttpClient private constructor() {
217217
/**
218218
* Whether to call `validate` on every response before returning it.
219219
*
220+
* Setting this to `true` is _not_ forwards compatible with new types from the API for
221+
* existing fields.
222+
*
220223
* Defaults to false, which means the shape of the response will not be validated upfront.
221224
* Instead, validation will only occur for the parts of the response that are accessed.
222225
*/

openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ class OpenlayerOkHttpClientAsync private constructor() {
217217
/**
218218
* Whether to call `validate` on every response before returning it.
219219
*
220+
* Setting this to `true` is _not_ forwards compatible with new types from the API for
221+
* existing fields.
222+
*
220223
* Defaults to false, which means the shape of the response will not be validated upfront.
221224
* Instead, validation will only occur for the parts of the response that are accessed.
222225
*/

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ private constructor(
6666
/**
6767
* Whether to call `validate` on every response before returning it.
6868
*
69+
* Setting this to `true` is _not_ forwards compatible with new types from the API for existing
70+
* fields.
71+
*
6972
* Defaults to false, which means the shape of the response will not be validated upfront.
7073
* Instead, validation will only occur for the parts of the response that are accessed.
7174
*/
@@ -230,6 +233,9 @@ private constructor(
230233
/**
231234
* Whether to call `validate` on every response before returning it.
232235
*
236+
* Setting this to `true` is _not_ forwards compatible with new types from the API for
237+
* existing fields.
238+
*
233239
* Defaults to false, which means the shape of the response will not be validated upfront.
234240
* Instead, validation will only occur for the parts of the response that are accessed.
235241
*/

openlayer-java-core/src/main/kotlin/com/openlayer/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
}

openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/CommitRetrieveResponse.kt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,14 @@ private constructor(
789789

790790
private var validated: Boolean = false
791791

792+
/**
793+
* Validates that the types of all values in this object match their expected types recursively.
794+
*
795+
* This method is _not_ forwards compatible with new types from the API for existing fields.
796+
*
797+
* @throws OpenlayerInvalidDataException if any value type in this object doesn't match its
798+
* expected type.
799+
*/
792800
fun validate(): CommitRetrieveResponse = apply {
793801
if (validated) {
794802
return@apply
@@ -1423,6 +1431,15 @@ private constructor(
14231431

14241432
private var validated: Boolean = false
14251433

1434+
/**
1435+
* Validates that the types of all values in this object match their expected types
1436+
* recursively.
1437+
*
1438+
* This method is _not_ forwards compatible with new types from the API for existing fields.
1439+
*
1440+
* @throws OpenlayerInvalidDataException if any value type in this object doesn't match its
1441+
* expected type.
1442+
*/
14261443
fun validate(): Commit = apply {
14271444
if (validated) {
14281445
return@apply
@@ -1634,6 +1651,15 @@ private constructor(
16341651

16351652
private var validated: Boolean = false
16361653

1654+
/**
1655+
* Validates that the types of all values in this object match their expected types
1656+
* recursively.
1657+
*
1658+
* This method is _not_ forwards compatible with new types from the API for existing fields.
1659+
*
1660+
* @throws OpenlayerInvalidDataException if any value type in this object doesn't match its
1661+
* expected type.
1662+
*/
16371663
fun validate(): Status = apply {
16381664
if (validated) {
16391665
return@apply
@@ -1782,6 +1808,15 @@ private constructor(
17821808

17831809
private var validated: Boolean = false
17841810

1811+
/**
1812+
* Validates that the types of all values in this object match their expected types
1813+
* recursively.
1814+
*
1815+
* This method is _not_ forwards compatible with new types from the API for existing fields.
1816+
*
1817+
* @throws OpenlayerInvalidDataException if any value type in this object doesn't match its
1818+
* expected type.
1819+
*/
17851820
fun validate(): Links = apply {
17861821
if (validated) {
17871822
return@apply

openlayer-java-core/src/main/kotlin/com/openlayer/api/models/commits/testresults/TestResultListParams.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,15 @@ private constructor(
404404

405405
private var validated: Boolean = false
406406

407+
/**
408+
* Validates that the types of all values in this object match their expected types
409+
* recursively.
410+
*
411+
* This method is _not_ forwards compatible with new types from the API for existing fields.
412+
*
413+
* @throws OpenlayerInvalidDataException if any value type in this object doesn't match its
414+
* expected type.
415+
*/
407416
fun validate(): Status = apply {
408417
if (validated) {
409418
return@apply
@@ -553,6 +562,15 @@ private constructor(
553562

554563
private var validated: Boolean = false
555564

565+
/**
566+
* Validates that the types of all values in this object match their expected types
567+
* recursively.
568+
*
569+
* This method is _not_ forwards compatible with new types from the API for existing fields.
570+
*
571+
* @throws OpenlayerInvalidDataException if any value type in this object doesn't match its
572+
* expected type.
573+
*/
556574
fun validate(): Type = apply {
557575
if (validated) {
558576
return@apply

0 commit comments

Comments
 (0)