Skip to content

Commit

Permalink
add optional param for Schema.arr to specify objects in array (#159)
Browse files Browse the repository at this point in the history
Co-authored-by: David Motsonashvili <[email protected]>
  • Loading branch information
davidmotson and David Motsonashvili authored Jun 4, 2024
1 parent b1803c4 commit 28016d1
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 28016d1

Please sign in to comment.