@@ -42,7 +42,7 @@ struct TypeMatcher {
42
42
func tryMatchBuiltinType( for schema: JSONSchema . Schema ) -> TypeUsage ? {
43
43
Self . _tryMatchRecursive (
44
44
for: schema,
45
- test: { schema in Self . _tryMatchBuiltinNonRecursive ( for: schema) } ,
45
+ test: { schema in _tryMatchBuiltinNonRecursive ( for: schema) } ,
46
46
matchedArrayHandler: { elementType, nullableItems in
47
47
nullableItems ? elementType. asOptional. asArray : elementType. asArray
48
48
} ,
@@ -68,7 +68,7 @@ struct TypeMatcher {
68
68
try Self . _tryMatchRecursive (
69
69
for: schema. value,
70
70
test: { ( schema) -> TypeUsage ? in
71
- if let builtinType = Self . _tryMatchBuiltinNonRecursive ( for: schema) { return builtinType }
71
+ if let builtinType = _tryMatchBuiltinNonRecursive ( for: schema) { return builtinType }
72
72
guard case let . reference( ref, _) = schema else { return nil }
73
73
return try TypeAssigner ( context: context) . typeName ( for: ref) . asUsage
74
74
} ,
@@ -88,9 +88,9 @@ struct TypeMatcher {
88
88
/// - A reference
89
89
/// - Parameter schema: The schema to match a referenceable type for.
90
90
/// - Returns: `true` if the schema is referenceable; `false` otherwise.
91
- static func isReferenceable( _ schema: JSONSchema ) -> Bool {
91
+ func isReferenceable( _ schema: JSONSchema ) -> Bool {
92
92
// This logic should be kept in sync with `tryMatchReferenceableType`.
93
- _tryMatchRecursive (
93
+ Self . _tryMatchRecursive (
94
94
for: schema. value,
95
95
test: { schema in
96
96
if _tryMatchBuiltinNonRecursive ( for: schema) != nil { return true }
@@ -110,7 +110,7 @@ struct TypeMatcher {
110
110
/// - A reference
111
111
/// - Parameter schema: The schema to match a referenceable type for.
112
112
/// - Returns: `true` if the schema is referenceable; `false` otherwise.
113
- static func isReferenceable( _ schema: UnresolvedSchema ? ) -> Bool {
113
+ func isReferenceable( _ schema: UnresolvedSchema ? ) -> Bool {
114
114
guard let schema else {
115
115
// fragment type is referenceable
116
116
return true
@@ -132,7 +132,7 @@ struct TypeMatcher {
132
132
/// referenceable.
133
133
/// - Parameter schema: The schema to match a referenceable type for.
134
134
/// - Returns: `true` if the schema is inlinable; `false` otherwise.
135
- static func isInlinable( _ schema: JSONSchema ) -> Bool { !isReferenceable( schema) }
135
+ func isInlinable( _ schema: JSONSchema ) -> Bool { !isReferenceable( schema) }
136
136
137
137
/// Returns a Boolean value that indicates whether the schema
138
138
/// needs to be defined inline.
@@ -143,14 +143,14 @@ struct TypeMatcher {
143
143
/// referenceable.
144
144
/// - Parameter schema: The schema to match a referenceable type for.
145
145
/// - Returns: `true` if the schema is inlinable; `false` otherwise.
146
- static func isInlinable( _ schema: UnresolvedSchema ? ) -> Bool { !isReferenceable( schema) }
146
+ func isInlinable( _ schema: UnresolvedSchema ? ) -> Bool { !isReferenceable( schema) }
147
147
148
148
/// Return a reference to a multipart element type if the provided schema is referenceable.
149
149
/// - Parameters:
150
150
/// - schema: The schema to try to reference.
151
151
/// - encoding: The associated encoding.
152
152
/// - Returns: A reference if the schema is referenceable, nil otherwise.
153
- static func multipartElementTypeReferenceIfReferenceable(
153
+ func multipartElementTypeReferenceIfReferenceable(
154
154
schema: UnresolvedSchema ? ,
155
155
encoding: OrderedDictionary < String , OpenAPI . Content . Encoding > ?
156
156
) -> OpenAPI . Reference < JSONSchema > ? {
@@ -174,11 +174,9 @@ struct TypeMatcher {
174
174
/// - components: The reusable components from the OpenAPI document.
175
175
/// - Throws: An error if there's an issue while checking the schema.
176
176
/// - Returns: `true` if the schema is a key-value pair; `false` otherwise.
177
- static func isKeyValuePair(
178
- _ schema: JSONSchema ,
179
- referenceStack: inout ReferenceStack ,
180
- components: OpenAPI . Components
181
- ) throws -> Bool {
177
+ func isKeyValuePair( _ schema: JSONSchema , referenceStack: inout ReferenceStack , components: OpenAPI . Components )
178
+ throws -> Bool
179
+ {
182
180
switch schema. value {
183
181
case . object, . fragment: return true
184
182
case . null, . boolean, . number, . integer, . string, . array, . not: return false
@@ -222,7 +220,7 @@ struct TypeMatcher {
222
220
/// - components: The reusable components from the OpenAPI document.
223
221
/// - Throws: An error if there's an issue while checking the schema.
224
222
/// - Returns: `true` if the schema is a key-value pair; `false` otherwise.
225
- static func isKeyValuePair(
223
+ func isKeyValuePair(
226
224
_ schema: UnresolvedSchema ? ,
227
225
referenceStack: inout ReferenceStack ,
228
226
components: OpenAPI . Components
@@ -285,7 +283,7 @@ struct TypeMatcher {
285
283
/// - Parameter schema: The schema to match a referenceable type for.
286
284
/// - Returns: A type usage for the schema if the schema is built-in.
287
285
/// Otherwise, returns nil.
288
- private static func _tryMatchBuiltinNonRecursive( for schema: JSONSchema . Schema ) -> TypeUsage ? {
286
+ private func _tryMatchBuiltinNonRecursive( for schema: JSONSchema . Schema ) -> TypeUsage ? {
289
287
let typeName : TypeName
290
288
switch schema {
291
289
case . boolean( _) : typeName = . swift( " Bool " )
0 commit comments