Skip to content

Commit

Permalink
Added a little bit of validation to make sure "items" aren't accident…
Browse files Browse the repository at this point in the history
…ally passed to property types that aren't arrays.
  • Loading branch information
btfranklin committed Jul 4, 2023
1 parent dd61c68 commit c7d02b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/CleverBird/datatypes/Function.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ public struct Function: Codable {
self.type = type
self.description = description
self.enumCases = enumCases

if items != nil && type != .array {
fatalError("Array items can only be provided to properties of type 'array', but type is '\(type)'")
}
self.items = items
}

Expand Down

0 comments on commit c7d02b7

Please sign in to comment.