From 47da86b0f2770c19619b59b096e0e5714a77c6ff Mon Sep 17 00:00:00 2001 From: Pawan Joshi Date: Wed, 22 May 2024 12:49:41 +0530 Subject: [PATCH] issue #504 | Crash when printing model schema, if one of the attributes is of the type URI Fixed --- Sources/DynamicSchema+Convenience.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/DynamicSchema+Convenience.swift b/Sources/DynamicSchema+Convenience.swift index 5254d5f2..68d23a39 100644 --- a/Sources/DynamicSchema+Convenience.swift +++ b/Sources/DynamicSchema+Convenience.swift @@ -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" }