Skip to content

Commit

Permalink
added shorthand initializers to JSONObject Item
Browse files Browse the repository at this point in the history
Signed-off-by: rawnly <[email protected]>
  • Loading branch information
rawnly committed Nov 19, 2023
1 parent 4380608 commit 378d985
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/OpenAI/Public/Models/Chat/JSONSchema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ public struct JSONSchema: Codable, Equatable {
public let minItems: Int?
public let maxItems: Int?
public let uniqueItems: Bool?

public static func string(description: String?=nil) -> Self {
return Property(type: .string, description: description)
}

public static func boolean(description: String?=nil) -> Self {
return Property(type: .boolean, description: description)
}

public static func number(description: String?=nil) -> Self {
return Property(type: .number, description: description)
}

private enum CodingKeys: String, CodingKey {
case type, description, format, items, required, pattern, const
Expand Down

0 comments on commit 378d985

Please sign in to comment.