Skip to content

Add title parameter to all static functions in Schema class #14971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions FirebaseAI/Sources/Types/Public/Schema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,21 @@ public final class Schema: Sendable {
/// - Parameters:
/// - description: An optional description of what the string should contain or represent; may
/// use Markdown format.
/// - title: An optional human-readable name/summary for the schema.
/// - nullable: If `true`, instructs the model that it *may* generate `null` instead of a
/// string; defaults to `false`, enforcing that a string value is generated.
/// - format: An optional modifier describing the expected format of the string. Currently no
/// formats are officially supported for strings but custom values may be specified using
/// ``StringFormat/custom(_:)``, for example `.custom("email")` or `.custom("byte")`; these
/// provide additional hints for how the model should respond but are not guaranteed to be
/// adhered to.
public static func string(description: String? = nil, nullable: Bool = false,
format: StringFormat? = nil) -> Schema {
public static func string(description: String? = nil, title: String? = nil,
nullable: Bool = false, format: StringFormat? = nil) -> Schema {
return self.init(
type: .string,
format: format?.rawValue,
description: description,
title: title,
nullable: nullable
)
}
Expand All @@ -202,15 +204,17 @@ public final class Schema: Sendable {
/// - values: The list of string values that may be generated by the model.
/// - description: An optional description of what the `values` contain or represent; may use
/// Markdown format.
/// - title: An optional human-readable name/summary for the schema.
/// - nullable: If `true`, instructs the model that it *may* generate `null` instead of one of
/// the strings specified in `values`; defaults to `false`, enforcing that one of the string
/// values is generated.
public static func enumeration(values: [String], description: String? = nil,
nullable: Bool = false) -> Schema {
title: String? = nil, nullable: Bool = false) -> Schema {
return self.init(
type: .string,
format: "enum",
description: description,
title: title,
nullable: nullable,
enumValues: values
)
Expand All @@ -229,18 +233,20 @@ public final class Schema: Sendable {
/// - Parameters:
/// - description: An optional description of what the number should contain or represent; may
/// use Markdown format.
/// - title: An optional human-readable name/summary for the schema.
/// - nullable: If `true`, instructs the model that it may generate `null` instead of a number;
/// defaults to `false`, enforcing that a number is generated.
/// - minimum: If specified, instructs the model that the value should be greater than or
/// equal to the specified minimum.
/// - maximum: If specified, instructs the model that the value should be less than or equal
/// to the specified maximum.
public static func float(description: String? = nil, nullable: Bool = false,
public static func float(description: String? = nil, title: String? = nil, nullable: Bool = false,
minimum: Float? = nil, maximum: Float? = nil) -> Schema {
return self.init(
type: .number,
format: "float",
description: description,
title: title,
nullable: nullable,
minimum: minimum.map { Double($0) },
maximum: maximum.map { Double($0) }
Expand All @@ -255,17 +261,20 @@ public final class Schema: Sendable {
/// - Parameters:
/// - description: An optional description of what the number should contain or represent; may
/// use Markdown format.
/// - title: An optional human-readable name/summary for the schema.
/// - nullable: If `true`, instructs the model that it may return `null` instead of a number;
/// defaults to `false`, enforcing that a number is returned.
/// - minimum: If specified, instructs the model that the value should be greater than or
/// equal to the specified minimum.
/// - maximum: If specified, instructs the model that the value should be less than or equal
/// to the specified maximum.
public static func double(description: String? = nil, nullable: Bool = false,
public static func double(description: String? = nil, title: String? = nil,
nullable: Bool = false,
minimum: Double? = nil, maximum: Double? = nil) -> Schema {
return self.init(
type: .number,
description: description,
title: title,
nullable: nullable,
minimum: minimum,
maximum: maximum
Expand All @@ -287,6 +296,7 @@ public final class Schema: Sendable {
/// - Parameters:
/// - description: An optional description of what the integer should contain or represent; may
/// use Markdown format.
/// - title: An optional human-readable name/summary for the schema.
/// - nullable: If `true`, instructs the model that it may return `null` instead of an integer;
/// defaults to `false`, enforcing that an integer is returned.
/// - format: An optional modifier describing the expected format of the integer. Currently the
Expand All @@ -296,13 +306,14 @@ public final class Schema: Sendable {
/// equal to the specified minimum.
/// - maximum: If specified, instructs the model that the value should be less than or equal
/// to the specified maximum.
public static func integer(description: String? = nil, nullable: Bool = false,
format: IntegerFormat? = nil,
public static func integer(description: String? = nil, title: String? = nil,
nullable: Bool = false, format: IntegerFormat? = nil,
minimum: Int? = nil, maximum: Int? = nil) -> Schema {
return self.init(
type: .integer,
format: format?.rawValue,
description: description,
title: title,
nullable: nullable.self,
minimum: minimum.map { Double($0) },
maximum: maximum.map { Double($0) }
Expand All @@ -317,10 +328,12 @@ public final class Schema: Sendable {
/// - Parameters:
/// - description: An optional description of what the boolean should contain or represent; may
/// use Markdown format.
/// - title: An optional human-readable name/summary for the schema.
/// - nullable: If `true`, instructs the model that it may return `null` instead of a boolean;
/// defaults to `false`, enforcing that a boolean is returned.
public static func boolean(description: String? = nil, nullable: Bool = false) -> Schema {
return self.init(type: .boolean, description: description, nullable: nullable)
public static func boolean(description: String? = nil, title: String? = nil,
nullable: Bool = false) -> Schema {
return self.init(type: .boolean, description: description, title: title, nullable: nullable)
}

/// Returns a `Schema` representing an array.
Expand All @@ -334,17 +347,20 @@ public final class Schema: Sendable {
/// - items: The `Schema` of the elements that the array will hold.
/// - description: An optional description of what the array should contain or represent; may
/// use Markdown format.
/// - title: An optional human-readable name/summary for the schema.
/// - nullable: If `true`, instructs the model that it may return `null` instead of an array;
/// defaults to `false`, enforcing that an array is returned.
/// - minItems: Instructs the model to produce at least the specified minimum number of elements
/// in the array; defaults to `nil`, meaning any number.
/// - maxItems: Instructs the model to produce at most the specified maximum number of elements
/// in the array.
public static func array(items: Schema, description: String? = nil, nullable: Bool = false,
minItems: Int? = nil, maxItems: Int? = nil) -> Schema {
public static func array(items: Schema, description: String? = nil, title: String? = nil,
nullable: Bool = false, minItems: Int? = nil,
maxItems: Int? = nil) -> Schema {
return self.init(
type: .array,
description: description,
title: title,
nullable: nullable,
items: items,
minItems: minItems,
Expand Down Expand Up @@ -384,7 +400,7 @@ public final class Schema: Sendable {
/// generated JSON string. See ``propertyOrdering`` for details.
/// - description: An optional description of what the object should contain or represent; may
/// use Markdown format.
/// - title: An optional human-readable name/summary for the object schema.
/// - title: An optional human-readable name/summary for the schema.
/// - nullable: If `true`, instructs the model that it may return `null` instead of an object;
/// defaults to `false`, enforcing that an object is returned.
public static func object(properties: [String: Schema], optionalProperties: [String] = [],
Expand Down
34 changes: 31 additions & 3 deletions FirebaseAI/Tests/Unit/Types/SchemaTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,24 @@

func testEncodeSchema_string_allOptions() throws {
let description = "Timestamp of the event."
let title = "Event Timestamp"
let format = Schema.StringFormat.custom("date-time")
let schema = Schema.string(description: description, nullable: true, format: format)
let schema = Schema.string(
description: description,
title: title,
nullable: true,
format: format
)

let jsonData = try encoder.encode(schema)

let json = try XCTUnwrap(String(data: jsonData, encoding: .utf8))
XCTAssertEqual(json, """

Check failure on line 58 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_string_allOptions, XCTAssertEqual failed: ("{

Check failure on line 58 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_string_allOptions, XCTAssertEqual failed: ("{

Check failure on line 58 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_string_allOptions, XCTAssertEqual failed: ("{

Check failure on line 58 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_string_allOptions, XCTAssertEqual failed: ("{

Check failure on line 58 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_string_allOptions, XCTAssertEqual failed: ("{

Check failure on line 58 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testEncodeSchema_string_allOptions, XCTAssertEqual failed: ("{

Check failure on line 58 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

testEncodeSchema_string_allOptions, XCTAssertEqual failed: ("{

Check failure on line 58 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_string_allOptions, XCTAssertEqual failed: ("{

Check failure on line 58 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-14, Xcode_16.2, spm)

testEncodeSchema_string_allOptions, XCTAssertEqual failed: ("{
{
"description" : "\(description)",
"format" : "date-time",
"nullable" : true,
"title": "\(title)",
"type" : "STRING"
}
""")
Expand Down Expand Up @@ -85,12 +92,18 @@
func testEncodeSchema_enumeration_allOptions() throws {
let values = ["NORTH", "SOUTH", "EAST", "WEST"]
let description = "Compass directions."
let schema = Schema.enumeration(values: values, description: description, nullable: true)
let title = "Directions"
let schema = Schema.enumeration(
values: values,
description: description,
title: title,
nullable: true
)

let jsonData = try encoder.encode(schema)

let json = try XCTUnwrap(String(data: jsonData, encoding: .utf8))
XCTAssertEqual(json, """

Check failure on line 106 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_enumeration_allOptions, XCTAssertEqual failed: ("{

Check failure on line 106 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_enumeration_allOptions, XCTAssertEqual failed: ("{

Check failure on line 106 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_enumeration_allOptions, XCTAssertEqual failed: ("{

Check failure on line 106 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_enumeration_allOptions, XCTAssertEqual failed: ("{

Check failure on line 106 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_enumeration_allOptions, XCTAssertEqual failed: ("{

Check failure on line 106 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testEncodeSchema_enumeration_allOptions, XCTAssertEqual failed: ("{

Check failure on line 106 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

testEncodeSchema_enumeration_allOptions, XCTAssertEqual failed: ("{

Check failure on line 106 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_enumeration_allOptions, XCTAssertEqual failed: ("{

Check failure on line 106 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-14, Xcode_16.2, spm)

testEncodeSchema_enumeration_allOptions, XCTAssertEqual failed: ("{
{
"description" : "\(description)",
"enum" : [
Expand All @@ -101,6 +114,7 @@
],
"format" : "enum",
"nullable" : true,
"title": "\(title)",
"type" : "STRING"
}
""")
Expand All @@ -125,10 +139,12 @@

func testEncodeSchema_float_allOptions() throws {
let description = "Temperature in Celsius."
let title = "Temperature (°C)"
let minimum: Float = -40.25
let maximum: Float = 50.5
let schema = Schema.float(
description: description,
title: title,
nullable: true,
minimum: minimum,
maximum: maximum
Expand All @@ -137,13 +153,14 @@
let jsonData = try encoder.encode(schema)

let json = try XCTUnwrap(String(data: jsonData, encoding: .utf8))
XCTAssertEqual(json, """

Check failure on line 156 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_float_allOptions, XCTAssertEqual failed: ("{

Check failure on line 156 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_float_allOptions, XCTAssertEqual failed: ("{

Check failure on line 156 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_float_allOptions, XCTAssertEqual failed: ("{

Check failure on line 156 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_float_allOptions, XCTAssertEqual failed: ("{

Check failure on line 156 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_float_allOptions, XCTAssertEqual failed: ("{

Check failure on line 156 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testEncodeSchema_float_allOptions, XCTAssertEqual failed: ("{

Check failure on line 156 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

testEncodeSchema_float_allOptions, XCTAssertEqual failed: ("{

Check failure on line 156 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_float_allOptions, XCTAssertEqual failed: ("{

Check failure on line 156 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-14, Xcode_16.2, spm)

testEncodeSchema_float_allOptions, XCTAssertEqual failed: ("{
{
"description" : "\(description)",
"format" : "float",
"maximum" : \(maximum),
"minimum" : \(minimum),
"nullable" : true,
"title": "\(title)",
"type" : "NUMBER"
}
""")
Expand All @@ -167,10 +184,12 @@

func testEncodeSchema_double_allOptions() throws {
let description = "Account balance."
let title = "Balance"
let minimum = 0.01
let maximum = 1_000_000.99
let schema = Schema.double(
description: description,
title: title,
nullable: true,
minimum: minimum,
maximum: maximum
Expand All @@ -179,12 +198,13 @@
let jsonData = try encoder.encode(schema)

let json = try XCTUnwrap(String(data: jsonData, encoding: .utf8))
XCTAssertEqual(json, """

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{

Check failure on line 201 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-14, Xcode_16.2, spm)

testEncodeSchema_double_allOptions, XCTAssertEqual failed: ("{
{
"description" : "\(description)",
"maximum" : \(maximum),
"minimum" : \(minimum),
"nullable" : true,
"title": "\(title)",
"type" : "NUMBER"
}
""")
Expand All @@ -208,11 +228,13 @@

func testEncodeSchema_integer_allOptions() throws {
let description = "User age."
let title = "Age"
let minimum = 0
let maximum = 120
let format = Schema.IntegerFormat.int32
let schema = Schema.integer(
description: description,
title: title,
nullable: true,
format: format,
minimum: minimum,
Expand All @@ -222,13 +244,14 @@
let jsonData = try encoder.encode(schema)

let json = try XCTUnwrap(String(data: jsonData, encoding: .utf8))
XCTAssertEqual(json, """

Check failure on line 247 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_integer_allOptions, XCTAssertEqual failed: ("{

Check failure on line 247 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_integer_allOptions, XCTAssertEqual failed: ("{

Check failure on line 247 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_integer_allOptions, XCTAssertEqual failed: ("{

Check failure on line 247 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_integer_allOptions, XCTAssertEqual failed: ("{

Check failure on line 247 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_integer_allOptions, XCTAssertEqual failed: ("{

Check failure on line 247 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testEncodeSchema_integer_allOptions, XCTAssertEqual failed: ("{

Check failure on line 247 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

testEncodeSchema_integer_allOptions, XCTAssertEqual failed: ("{

Check failure on line 247 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_integer_allOptions, XCTAssertEqual failed: ("{

Check failure on line 247 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-14, Xcode_16.2, spm)

testEncodeSchema_integer_allOptions, XCTAssertEqual failed: ("{
{
"description" : "\(description)",
"format" : "int32",
"maximum" : \(maximum),
"minimum" : \(minimum),
"nullable" : true,
"title": "\(title)",
"type" : "INTEGER"
}
""")
Expand All @@ -252,15 +275,17 @@

func testEncodeSchema_boolean_allOptions() throws {
let description = "Is the user an administrator?"
let schema = Schema.boolean(description: description, nullable: true)
let title = "Administrator Check"
let schema = Schema.boolean(description: description, title: title, nullable: true)

let jsonData = try encoder.encode(schema)

let json = try XCTUnwrap(String(data: jsonData, encoding: .utf8))
XCTAssertEqual(json, """

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{

Check failure on line 284 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-14, Xcode_16.2, spm)

testEncodeSchema_boolean_allOptions, XCTAssertEqual failed: ("{
{
"description" : "\(description)",
"nullable" : true,
"title": "\(title)",
"type" : "BOOLEAN"
}
""")
Expand Down Expand Up @@ -290,11 +315,13 @@
func testEncodeSchema_array_allOptions() throws {
let itemsSchema = Schema.integer(format: .int64)
let description = "List of product IDs."
let title = "Product IDs"
let minItems = 1
let maxItems = 10
let schema = Schema.array(
items: itemsSchema,
description: description,
title: title,
nullable: true,
minItems: minItems,
maxItems: maxItems
Expand All @@ -303,7 +330,7 @@
let jsonData = try encoder.encode(schema)

let json = try XCTUnwrap(String(data: jsonData, encoding: .utf8))
XCTAssertEqual(json, """

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, catalyst)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, visionOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, tvOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, macOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, watchOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.3, iOS)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-15, Xcode_16.3, spm)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-14, Xcode_16.2, spm)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{

Check failure on line 333 in FirebaseAI/Tests/Unit/Types/SchemaTests.swift

View workflow job for this annotation

GitHub Actions / swift-build-run (macos-14, Xcode_16.2, spm)

testEncodeSchema_array_allOptions, XCTAssertEqual failed: ("{
{
"description" : "\(description)",
"items" : {
Expand All @@ -314,6 +341,7 @@
"maxItems" : \(maxItems),
"minItems" : \(minItems),
"nullable" : true,
"title": "\(title)",
"type" : "ARRAY"
}
""")
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ func googleAppMeasurementDependency() -> Package.Dependency {
return .package(url: appMeasurementURL, branch: "main")
}

return .package(url: appMeasurementURL, exact: "11.14.0")
return .package(url: appMeasurementURL, branch: "main")
}

func abseilDependency() -> Package.Dependency {
Expand Down
Loading