yonaskolb / SwagGen

OpenAPI/Swagger 3.0 Parser and Swift code generator
MIT License
627 stars 147 forks source link

SwageGen No such module 'Result' #84

Closed mihirpmehta closed 6 years ago

mihirpmehta commented 6 years ago

When i try to generate the code for my swagger url, It generates a file called APIResult.Swift which looks like this

import Result

public typealias APIResult<T> = Result<T, APIError>

Compiler gives me error that

No such module 'Result'

If i replace import Result with import Alamofire the error changes to

Generic type 'Result' specialized with too many type parameters (got 2, but expected 1)

here is my URL from which i am generating the code

http://relatr-dev.westeurope.cloudapp.azure.com:8080/swagger/v1/swagger.json

yonaskolb commented 6 years ago

The framework that SwagGen generates for Swift has some dependencies, Result being one of them. These dependencies are all defined in PodFile for Cocoapods, CartFile for Carthage and Package.swift for the Swift Package Manager. So it depends on what dependency manager you use for how to integrate these

mihirpmehta commented 6 years ago

I have installed the 'Result' it works but ....

I have installed SwagGen by homebrew .... I couldn't find place where i can see this module as dependency ....

You can close this issue.

yonaskolb commented 6 years ago

The dependency files are in your generated directory

mihirpmehta commented 6 years ago

Ah i see... Sorry for bothering you... this is the first time i am using Swagger generated code

yonaskolb commented 6 years ago

All good. Let me know if you have any more questions. Closing this for now