@@ -86,13 +86,13 @@ struct AnyJSONSchemaComponent: JSONSchemaComponent, @unchecked Sendable {
8686}
8787
8888// 👇 Wrap helper for nicer syntax
89- func wrap( _ schema: any JSONSchemaComponent ) -> AnyJSONSchemaComponent {
89+ func wrap( _ schema: any JSONSchemaComponent & Sendable ) -> AnyJSONSchemaComponent {
9090 . init( wrapped: schema)
9191}
9292
9393// MARK: - Builder helpers
9494
95- func build( @JSONSchemaBuilder _ content: ( ) -> any JSONSchemaComponent ) -> any JSONSchemaComponent {
95+ func build( @JSONSchemaBuilder _ content: ( ) -> any JSONSchemaComponent & Sendable ) -> any JSONSchemaComponent & Sendable {
9696 content ( )
9797}
9898
@@ -118,7 +118,7 @@ func createSpecContent(type: Any.Type, name: String?) -> SpecContent {
118118
119119protocol TypeDescription {
120120 static var name : String { get }
121- static var schema : any JSONSchemaComponent { get }
121+ static var schema : any JSONSchemaComponent & Sendable { get }
122122}
123123
124124func getName( type: Any . Type ) -> String {
@@ -128,7 +128,7 @@ func getName(type: Any.Type) -> String {
128128 return String ( describing: type)
129129}
130130
131- func getSchema( type: Any . Type ) -> any JSONSchemaComponent {
131+ func getSchema( type: Any . Type ) -> any JSONSchemaComponent & Sendable {
132132 if let t = type as? TypeDescription . Type {
133133 return t. schema
134134 }
@@ -160,24 +160,24 @@ extension Optional: TypeDescription {
160160 " Optional< \( getName ( type: Wrapped . self) ) > "
161161 }
162162
163- static var schema : any JSONSchemaComponent {
163+ static var schema : any JSONSchemaComponent & Sendable {
164164 getSchema ( type: Wrapped . self)
165165 }
166166}
167167
168168extension Bool : TypeDescription {
169169 static var name : String { " Bool " }
170- static var schema : any JSONSchemaComponent { JSONBoolean ( ) }
170+ static var schema : any JSONSchemaComponent & Sendable { JSONBoolean ( ) }
171171}
172172
173173extension String : TypeDescription {
174174 static var name : String { " String " }
175- static var schema : any JSONSchemaComponent { JSONString ( ) }
175+ static var schema : any JSONSchemaComponent & Sendable { JSONString ( ) }
176176}
177177
178178extension BinaryInteger where Self: TypeDescription {
179179 static var name : String { String ( describing: Self . self) }
180- static var schema : any JSONSchemaComponent { JSONInteger ( ) }
180+ static var schema : any JSONSchemaComponent & Sendable { JSONInteger ( ) }
181181}
182182
183183extension Int8 : TypeDescription { }
@@ -193,21 +193,21 @@ extension UInt: TypeDescription {}
193193
194194extension Data : TypeDescription {
195195 static var name : String { " Data " }
196- static var schema : any JSONSchemaComponent {
196+ static var schema : any JSONSchemaComponent & Sendable {
197197 JSONString ( ) . title ( name) . pattern ( " ^0x[0-9a-fA-F]*$ " )
198198 }
199199}
200200
201201extension FixedSizeData : TypeDescription {
202202 static var name : String { " Data \( T . value) " }
203- static var schema : any JSONSchemaComponent {
203+ static var schema : any JSONSchemaComponent & Sendable {
204204 JSONString ( ) . title ( name) . pattern ( " ^0x[0-9a-fA-F]{ \( T . value * 2 ) }$ " )
205205 }
206206}
207207
208208extension Array : TypeDescription {
209209 static var name : String { " Array< \( getName ( type: Element . self) ) > " }
210- static var schema : any JSONSchemaComponent {
210+ static var schema : any JSONSchemaComponent & Sendable {
211211 JSONArray { wrap ( getSchema ( type: Element . self) ) }
212212 }
213213}
@@ -217,7 +217,7 @@ extension Dictionary: TypeDescription {
217217 " Dictionary< \( getName ( type: Key . self) ) , \( getName ( type: Value . self) ) > "
218218 }
219219
220- static var schema : any JSONSchemaComponent {
220+ static var schema : any JSONSchemaComponent & Sendable {
221221 JSONObject ( ) . title ( name)
222222 }
223223}
@@ -227,7 +227,7 @@ extension Set: TypeDescription {
227227 " Set< \( getName ( type: Element . self) ) > "
228228 }
229229
230- static var schema : any JSONSchemaComponent {
230+ static var schema : any JSONSchemaComponent & Sendable {
231231 JSONArray { wrap ( getSchema ( type: Element . self) ) }
232232 }
233233}
@@ -241,7 +241,7 @@ extension LimitedSizeArray: TypeDescription {
241241 }
242242 }
243243
244- static var schema : any JSONSchemaComponent {
244+ static var schema : any JSONSchemaComponent & Sendable {
245245 JSONArray { wrap ( getSchema ( type: T . self) ) }
246246 }
247247}
@@ -251,14 +251,14 @@ extension ConfigLimitedSizeArray: TypeDescription {
251251 " Array< \( getName ( type: T . self) ) >[ \( getName ( type: TMinLength . self) ) ..< \( getName ( type: TMaxLength . self) ) ] "
252252 }
253253
254- static var schema : any JSONSchemaComponent {
254+ static var schema : any JSONSchemaComponent & Sendable {
255255 JSONArray { wrap ( getSchema ( type: T . self) ) }
256256 }
257257}
258258
259259extension Ref : TypeDescription {
260260 static var name : String { getName ( type: T . self) }
261- static var schema : any JSONSchemaComponent {
261+ static var schema : any JSONSchemaComponent & Sendable {
262262 getSchema ( type: T . self)
263263 }
264264}
0 commit comments