Skip to content

Commit 4ddfb6f

Browse files
authored
update generator faq (#19869)
1 parent 3b3f9a7 commit 4ddfb6f

1 file changed

Lines changed: 18 additions & 21 deletions

File tree

docs/faq-generators.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ There is a new `swift6` generator, that is currently in beta, try it and give us
100100

101101
### How do I implement bearer token authentication with URLSession on the Swift 5 API client?
102102

103-
<details>
104-
<summary>First you subclass RequestBuilderFactory</summary>
103+
First you subclass RequestBuilderFactory
105104

105+
```
106106
class BearerRequestBuilderFactory: RequestBuilderFactory {
107107
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
108108
BearerRequestBuilder<T>.self
@@ -112,11 +112,10 @@ There is a new `swift6` generator, that is currently in beta, try it and give us
112112
BearerDecodableRequestBuilder<T>.self
113113
}
114114
}
115-
</details>
116-
117-
<details>
118-
<summary>Then you subclass URLSessionRequestBuilder and URLSessionDecodableRequestBuilder </summary>
115+
```
119116

117+
Then you subclass URLSessionRequestBuilder and URLSessionDecodableRequestBuilder
118+
```
120119
class BearerRequestBuilder<T>: URLSessionRequestBuilder<T> {
121120
@discardableResult
122121
override func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
@@ -245,8 +244,7 @@ There is a new `swift6` generator, that is currently in beta, try it and give us
245244
completionHandler()
246245
}
247246
}
248-
249-
</details>
247+
```
250248

251249
Then you assign the `BearerRequestBuilderFactory` to the property `requestBuilderFactory`.
252250

@@ -260,9 +258,9 @@ Here is a working sample that put's together all of this.
260258

261259
### How do I implement bearer token authentication with Alamofire on the Swift 5 API client?
262260

263-
<details>
264-
<summary>First you subclass RequestBuilderFactory</summary>
261+
First you subclass RequestBuilderFactory
265262

263+
```
266264
class BearerRequestBuilderFactory: RequestBuilderFactory {
267265
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
268266
BearerRequestBuilder<T>.self
@@ -272,11 +270,10 @@ Here is a working sample that put's together all of this.
272270
BearerDecodableRequestBuilder<T>.self
273271
}
274272
}
275-
</details>
276-
277-
<details>
278-
<summary>Then you subclass AlamofireRequestBuilder and AlamofireDecodableRequestBuilder</summary>
273+
```
279274

275+
Then you subclass AlamofireRequestBuilder and AlamofireDecodableRequestBuilder
276+
```
280277
class BearerRequestBuilder<T>: AlamofireRequestBuilder<T> {
281278
override func createSessionManager() -> SessionManager {
282279
let sessionManager = super.createSessionManager()
@@ -334,7 +331,7 @@ Here is a working sample that put's together all of this.
334331
completionHandler(true)
335332
}
336333
}
337-
</details>
334+
```
338335

339336
Then you assign the `BearerRequestBuilderFactory` to the property `requestBuilderFactory`.
340337

@@ -348,8 +345,8 @@ Here is a working sample that put's together all of this.
348345

349346
### How do I implement bearer token authentication with URLSession on the Swift 6 API client?
350347

351-
<details>
352-
<summary>First you implement the `OpenAPIInterceptor` protocol.</summary>
348+
First you implement the `OpenAPIInterceptor` protocol.
349+
```
353350
public class BearerOpenAPIInterceptor: OpenAPIInterceptor {
354351
public init() {}
355352
@@ -419,7 +416,7 @@ public class BearerOpenAPIInterceptor: OpenAPIInterceptor {
419416
completionHandler(dummyBearerToken)
420417
}
421418
}
422-
</details>
419+
```
423420

424421
Then you assign the `BearerOpenAPIInterceptor` to the property `OpenAPIClient.shared.interceptor`.
425422

@@ -431,8 +428,8 @@ Here is a working sample that put's together all of this.
431428

432429
### How do I implement bearer token authentication with Alamofire on the Swift 6 API client?
433430

434-
<details>
435-
<summary>First implement the `Alamofire` `RequestInterceptor` protocol.</summary>
431+
First implement the `Alamofire` `RequestInterceptor` protocol.
432+
```
436433
class BearerTokenHandler: RequestInterceptor, @unchecked Sendable {
437434
private var bearerToken: String? = nil
438435
@@ -468,7 +465,7 @@ class BearerTokenHandler: RequestInterceptor, @unchecked Sendable {
468465
completionHandler(true)
469466
}
470467
}
471-
</details>
468+
```
472469

473470
Then you assign the `BearerTokenHandler` to the property `OpenAPIClient.shared.interceptor`.
474471

0 commit comments

Comments
 (0)