yonaskolb / SwagGen

OpenAPI/Swagger 3.0 Parser and Swift code generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swagger_2

alandeguz opened this issue · comments

Continuation of closed isue #144

I (and several others, apprently) can't get the swagger2 branch to compile. It seems to be a resolution error.

Latest Catalina 10.15.3, with current version of Xcode (11.3.1) or previous major release (10.3.0) yield the same error.

$ sudo xcode-select -s /Applications/Xcode-10.3.0.app/Contents/Developer
$ git checkout swagger_2 
$ swift package resolve
Updating https://github.com/kylef/PathKit.git
Updating https://github.com/yonaskolb/JSONUtilities.git
Updating https://github.com/kylef/Spectre.git
Updating https://github.com/jakeheis/SwiftCLI
Updating https://github.com/yonaskolb/Stencil.git
Updating https://github.com/jpsim/Yams.git
Updating https://github.com/onevcat/Rainbow.git
error: dependency graph is unresolvable; found these conflicting requirements:

Dependencies: 
    https://github.com/yonaskolb/Stencil.git @ 0.9.0..<1.0.0
    https://github.com/yonaskolb/JSONUtilities.git @ 3.3.0..<4.0.0

If I use Xcode 11.4 beta 3, I get a slightly more information error message.

$ sudo xcode-select -s /Applications/Xcode-11.4.0-beta-3.app/Contents/Developer
$ swift package resolve
Updating https://github.com/jpsim/Yams.git
Updating https://github.com/kylef/Spectre.git
Updating https://github.com/yonaskolb/Stencil.git
Updating https://github.com/yonaskolb/JSONUtilities.git
Updating https://github.com/kylef/PathKit.git
Updating https://github.com/onevcat/Rainbow.git
Updating https://github.com/jakeheis/SwiftCLI
error: because JSONUtilities 1.0.3..<4.0.4 contains incompatible tools version and root depends on JSONUtilities 3.3.0..<4.0.0, version solving failed.

Using mint to install (depending on the version of Xcode selected) yields the errors, depending on the version of Xcode selected.

Any suggestions?

The swagger_2 branch probably just needs to have its dependencies updated. Probably Spectre and PathKit need to be update to align, as they are both used in other projects. Happy to accept a PR for that

Hi @alandeguz,

I have this configuration working everyday in our CI.
This is what you should do.

Make sure you have swift 4.2 installed because Swaggen 3.0.2 only works with Swift 4.2

brew install kylef/formulae/swiftenv
swiftenv install 4.2
swiftenv global 4.2

Then rebuild SwagGen with Swift 4.2.

git clone https://github.com/yonaskolb/SwagGen.git
cd SwagGen
git checkout 3.0.2

/Library/Developer/Toolchains/swift-4.2-RELEASE.xctoolchain/usr/bin/swift build --disable-sandbox -c release -Xswiftc -static-stdlib
mkdir -p /usr/local/bin
cp -f .build/release/swaggen /usr/local/bin/swaggen
mkdir -p /usr/local/share/swaggen
cp -R "${PWD}/Templates" /usr/local/share/swaggen/Templates

Then on generation every should work.

swaggen generate swagger.json \
--template Templates/Swift  \
--language swift \
--template Templates/Swift/template.yml \
--destination Generated/Swift \
--clean all

@mackoj - Worked perfectly, thanks!
@yonaskolb - I'll dig in and give it a shot. Thanks for the hardwork on this project.