Starting with Swift 5.1, networking related functionality has been moved to FoundationNetworking. It needs to be imported for the codegen to work.
To Reproduce
Compile the code generated for any request with Swift 5.x and the following error is produced:
error: 'URLSession' is unavailable: This type has moved to the FoundationNetworking module. Import that module to use it.
let task = URLSession.shared.dataTask(with: request) { data, response, error in
Expected code snippet and corresponding request
The following code should be present in the generated code to work with Swift 5.x:
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif