Skip to content

Commit

Permalink
issue JohnEstropia#504 | Crash when printing model schema, if one of …
Browse files Browse the repository at this point in the history
…the attributes is of the type URI

Fixed
  • Loading branch information
pawan-joshi committed May 22, 2024
1 parent 7c2129e commit 47da86b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/DynamicSchema+Convenience.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ extension DynamicSchema {
}
else if attribute.isOptional {

valueTypeString += "?"
defaultString = " = nil"
}
case .URIAttributeType:
valueTypeString = String(describing: URL.self)
if let defaultValue = (attribute.defaultValue as! URL.QueryableNativeType?).flatMap(URL.cs_fromQueryableNativeType) {
defaultString = " = \"\(defaultValue.absoluteString)\""
} else if attribute.isOptional {
valueTypeString += "?"
defaultString = " = nil"
}
Expand Down

0 comments on commit 47da86b

Please sign in to comment.