Skip to content

Commit 412cef4

Browse files
authored
Add @jvmoverloads to schema declarations (#6355)
Adding the overloads is necessary to ensure the devEx in Java is better, and no unnecessary parameters are passed to the Schema factory methods.
1 parent 996acd8 commit 412cef4

File tree

1 file changed

+9
-0
lines changed
  • firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type

1 file changed

+9
-0
lines changed

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Schema.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ internal constructor(
3636
public companion object {
3737
/** Returns a schema for a boolean */
3838
@JvmStatic
39+
@JvmOverloads
3940
public fun boolean(description: String? = null, nullable: Boolean = false): Schema =
4041
Schema(
4142
description = description,
@@ -51,6 +52,7 @@ internal constructor(
5152
*/
5253
@JvmStatic
5354
@JvmName("numInt")
55+
@JvmOverloads
5456
public fun integer(description: String? = null, nullable: Boolean = false): Schema =
5557
Schema(
5658
description = description,
@@ -67,6 +69,7 @@ internal constructor(
6769
*/
6870
@JvmStatic
6971
@JvmName("numLong")
72+
@JvmOverloads
7073
public fun long(description: String? = null, nullable: Boolean = false): Schema =
7174
Schema(
7275
description = description,
@@ -82,6 +85,7 @@ internal constructor(
8285
*/
8386
@JvmStatic
8487
@JvmName("numDouble")
88+
@JvmOverloads
8589
public fun double(description: String? = null, nullable: Boolean = false): Schema =
8690
Schema(description = description, nullable = nullable, type = "NUMBER", format = "double")
8791

@@ -93,6 +97,7 @@ internal constructor(
9397
*/
9498
@JvmStatic
9599
@JvmName("numFloat")
100+
@JvmOverloads
96101
public fun float(description: String? = null, nullable: Boolean = false): Schema =
97102
Schema(description = description, nullable = nullable, type = "NUMBER", format = "float")
98103

@@ -105,6 +110,7 @@ internal constructor(
105110
*/
106111
@JvmStatic
107112
@JvmName("str")
113+
@JvmOverloads
108114
public fun string(
109115
description: String? = null,
110116
nullable: Boolean = false,
@@ -125,6 +131,7 @@ internal constructor(
125131
* @param nullable: Whether null is a valid value for this schema
126132
*/
127133
@JvmStatic
134+
@JvmOverloads
128135
public fun obj(
129136
properties: Map<String, Schema>,
130137
optionalProperties: List<String> = emptyList(),
@@ -153,6 +160,7 @@ internal constructor(
153160
* @param nullable: Whether null is a valid value for this schema
154161
*/
155162
@JvmStatic
163+
@JvmOverloads
156164
public fun array(
157165
items: Schema,
158166
description: String? = null,
@@ -173,6 +181,7 @@ internal constructor(
173181
* @param nullable: Whether null is a valid value for this schema
174182
*/
175183
@JvmStatic
184+
@JvmOverloads
176185
public fun enumeration(
177186
values: List<String>,
178187
description: String? = null,

0 commit comments

Comments
 (0)