准备
下载https://github.com/goharbor/harbor/blob/main/api/v2.0/swagger.yaml
下载https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.43/swagger-codegen-cli-2.4.43.jar
生成调用代码
swagger-codegen-cli是用java写的, 但是支持生成多种语言的调用代码, 如下
执行
java -jar swagger-codegen-cli-2.4.43.jar langs
支持的语言如下
Available languages: [ada, ada-server, akka-scala, android, apache2, apex, aspnetcore, bash, csharp, clojure, cwiki, cpprest, csharp-dotnet2, dart, dart-jaguar, elixir, elm, eiffel, erlang-client, erlang-server, finch, flash, python-flask, go, go-server, groovy, haskell-http-client, haskell, jmeter, jaxrs-cxf-client, jaxrs-cxf, java, inflector, jaxrs-cxf-cdi, jaxrs-spec, jaxrs, msf4j, java-pkmst, java-play-framework, jaxrs-resteasy-eap, jaxrs-resteasy, javascript, javascript-closure-angular, java-vertx, kotlin, lua, lumen, nancyfx, nodejs-server, objc, perl, php, powershell, pistache-server, python, qt5cpp, r, rails5, restbed, ruby, rust, rust-server, scala, scala-lagom-server, scalatra, scalaz, php-silex, sinatra, slim, spring, dynamic-html, html2, html, swagger, swagger-yaml, swift5, swift4, swift3, swift, php-symfony, tizen, typescript-aurelia, typescript-angular, typescript-inversify, typescript-angularjs, typescript-fetch, typescript-jquery, typescript-node, ue4cpp, undertow, ze-ph, kotlin-server]
这里我们生成java调用代码
java -jar swagger-codegen-cli-2.4.43.jar generate -i swagger.yaml -l java -o harborclient
标签:jaxrs,typescript,java,cli,harbor,server,yaml,私库,swagger
From: https://www.cnblogs.com/iminifly/p/18516406