LoginSignup
0
0

More than 5 years have passed since last update.

brew upgrade --cleanup で気軽にアップデートした swagger-codegen のバージョンを下げる

Posted at

ただの備忘録です。

brew upgrade --cleanup を時々実行しているのだけれど、
ある時突然それまで動いていた swagger-codegen が失敗するようになった。
(しばらく気づかなかったがこの原因は [Typescript-fetch] Is version 3 going to include the generator Typescript-fetch。)

エラー内容はこちら。

Exception in thread "main" java.lang.RuntimeException: Can't load config class with name typescript-fetch Available: aspnetcore
csharp
csharp-dotnet2
dynamic-html
html
html2
java
jaxrs-cxf-client
jaxrs-cxf
inflector
jaxrs-cxf-cdi
jaxrs-spec
jaxrs-jersey
jaxrs-di
jaxrs-resteasy-eap
jaxrs-resteasy
spring
openapi
openapi-yaml
kotlin-client
kotlin-server
php
scala
scala-akka-http-server
swift3
swift4
typescript-angular

    at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:31)
    at io.swagger.codegen.v3.cli.SwaggerCodegen.main(SwaggerCodegen.java:96)
Caused by: java.lang.ClassNotFoundException: typescript-fetch
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:29)
    ... 1 more

以前は動いていたので、brew によるアップデートを疑い、現在のバージョン確認。

> swagger-codegen version
3.0.3

なるほど。
とりあえず動いていたバージョンを入れていたはずなので、そこまで戻す事を試みる。

> brew info swagger-codegen
swagger-codegen: stable 3.0.3 (bottled), HEAD
Generate clients, server stubs, and docs from an OpenAPI spec
https://swagger.io/swagger-codegen/
/usr/local/Cellar/swagger-codegen/3.0.3 (6 files, 18.8MB) *
  Poured from bottle on 2018-12-18 at 12:42:05
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/swagger-codegen.rb
==> Dependencies
Build: maven ✔
==> Requirements
Required: java = 1.8 ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 3,356 (30 days), 6,685 (90 days), 27,574 (365 days)
install_on_request: 3,128 (30 days), 6,377 (90 days), 25,778 (365 days)
build_error: 0 (30 days)

…ここで以前のバージョンも表示されて切り替えられる事を期待していたが、そういえば --cleanup していたんだった。
仕方がないのでコミットログから一つ前のバージョンまで戻す。

> cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

> git log --oneline Formula/swagger-codegen.rb
6517e3cdbe swagger-codegen: update 3.0.3 bottle.
2fbaf34a32 swagger-codegen 3.0.3
67949e690a swagger-codegen: update 3.0.2 bottle.
4b85c01b11 swagger-codegen 3.0.2
779f153944 swagger-codegen: fix dependency order
93321a2021 swagger-codegen: update 2.3.1 bottle.

tig Formula/swagger-codegen.rb で確認しようとしたら読み込みに時間がかかりすぎたので git log で。

上記 issue に気づいておらず、とりあえず一つバージョンを戻してみる。

> git checkout 67949e690a Formula/swagger-codegen.rb

> brew uninstall swagger-codegen
Uninstalling /usr/local/Cellar/swagger-codegen/3.0.3... (6 files, 18.8MB)

> brew install swagger-codegen
==> Downloading https://homebrew.bintray.com/bottles/swagger-codegen-3.0.2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring swagger-codegen-3.0.2.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/swagger-codegen/3.0.2: 6 files, 18.5MB

> swagger-codegen version
3.0.2

…しかし同じエラーが出る。
この辺で swagger-api/swagger-codegen リポジトリの issue を typescript-fetch とかで検索し、上記 issue に気づく。

> git checkout 93321a2021 Formula/swagger-codegen.rb

> brew uninstall swagger-codegen
Uninstalling /usr/local/Cellar/swagger-codegen/3.0.2... (6 files, 18.5MB)

> brew install swagger-codegen
==> Downloading https://homebrew.bintray.com/bottles/swagger-codegen-2.3.1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring swagger-codegen-2.3.1.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/swagger-codegen/2.3.1: 6 files, 13.7MB

> swagger-codegen version
2.3.1

ここまで戻して成功を確認。
以上。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0