TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Auto-Generate Scala API Clients for REST APIs

4 pointsby wing328hkabout 5 years ago
We&#x27;ve added a new generator to OpenAPI Generator (https:&#x2F;&#x2F;github.com&#x2F;OpenAPITools&#x2F;openapi-generator) to generate Scala (sttp - https:&#x2F;&#x2F;github.com&#x2F;softwaremill&#x2F;sttp) API clients. To generate the client given an [OpenAPI&#x2F;Swagger specification file](https:&#x2F;&#x2F;github.com&#x2F;OAI&#x2F;OpenAPI-Specification), please follow 3 simple steps below:<p>1. Download the Java JAR: https:&#x2F;&#x2F;oss.sonatype.org&#x2F;content&#x2F;repositories&#x2F;snapshots&#x2F;org&#x2F;openapitools&#x2F;openapi-generator-cli&#x2F;4.3.0-SNAPSHOT&#x2F;openapi-generator-cli-4.3.0-20200304.092413-177.jar<p>2. Rename the JAR as &quot;openapi-generator-cli.jar&quot;<p>3. Run the following command to generate a Scala (sttp) API client for the Petstore API: https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;OpenAPITools&#x2F;openapi-generator&#x2F;master&#x2F;modules&#x2F;openapi-generator&#x2F;src&#x2F;test&#x2F;resources&#x2F;2_0&#x2F;petstore.yaml<p>Mac&#x2F;Linux:<p>$ java -jar openapi-generator-cli.jar generate -g scala-sttp -i https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;OpenAPITools&#x2F;openapi-generator&#x2F;master&#x2F;modules&#x2F;openapi-generator&#x2F;src&#x2F;test&#x2F;resources&#x2F;2_0&#x2F;petstore.yaml -o &#x2F;var&#x2F;tmp&#x2F;scala-sttp&#x2F;<p>Windows:<p>$ java -jar openapi-generator-cli.jar generate -g scala-sttp -i https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;OpenAPITools&#x2F;openapi-generator&#x2F;master&#x2F;modules&#x2F;openapi-generator&#x2F;src&#x2F;test&#x2F;resources&#x2F;2_0&#x2F;petstore.yaml -o C:\tmp\scala-sttp<p>If you&#x27;ve any feedback or question, please let us know via https:&#x2F;&#x2F;github.com&#x2F;OpenAPITools&#x2F;openapi-generator&#x2F;issues&#x2F;new.<p>The new generator will be included in the upcoming v4.3.0 stable release.<p>Thanks for the new generator by Aleksandr Nekrasov (https:&#x2F;&#x2F;github.com&#x2F;chameleon82)<p>Ref: https:&#x2F;&#x2F;github.com&#x2F;OpenAPITools&#x2F;openapi-generator&#x2F;pull&#x2F;5429

no comments

no comments