Skip to content

Commit

Permalink
add optional param for Schema.arr to specify objects in array (google…
Browse files Browse the repository at this point in the history
…-gemini#159)

Co-authored-by: David Motsonashvili <[email protected]>
  • Loading branch information
2 people authored and PatilShreyas committed Sep 21, 2024
1 parent 04f52d4 commit b94f27e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,17 @@ class Schema<T>(
nullable = false,
)

/** Registers a schema for an array */
fun arr(name: String, description: String) =
/**
* Registers a schema for an array.
*
* @param items can be used to specify the type of the array
*/
fun arr(name: String, description: String, items: Schema<out Any>? = null) =
Schema<List<String>>(
name = name,
description = description,
type = FunctionType.ARRAY,
items = items,
nullable = false,
)

Expand Down

0 comments on commit b94f27e

Please sign in to comment.