swagger-api / swagger-api/swagger-codegen

trying to use the Bash code generator, but bash isn't in the list of supported languages?

Open
#11,291 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

This may be a dumb question, or maybe I'm just doing it wrong, but I'm unable to get the Swagger code generator to work out-of-the-box to generate Bash client code.
I am able to get it working to generate Ruby and Java client code, but not bash.

Is there something special I need to do to get bash code generation working and I just missed it in the README?

Swagger-codegen version

I'm using: https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.30/swagger-codegen-cli-3.0.30.jar

Swagger declaration file content or url

I can provide the swagger JSON if necessary but that doesn't seem to be the issue here because the JSON works fine for other languages.

Command line used for generation
> java -jar swagger-codegen-cli-3.jar generate -l bash -i ~/Downloads/myapi.json -o ./myapi-client

Exception in thread "main" java.lang.RuntimeException: Can't load config class with name bash Available: dart
aspnetcore
csharp
csharp-dotnet2
go
go-server
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
micronaut
spring
nodejs-server
openapi
openapi-yaml
kotlin-client
kotlin-server
php
python
python-flask
r
ruby
scala
scala-akka-http-server
swift3
swift4
swift5
typescript-angular
typescript-axios
typescript-fetch
javascript

        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: Bash
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:315)
        at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:29)
        ... 1 more
Steps to reproduce

java -jar swagger-codegen-cli-3.jar generate -l bash -i ~/Downloads/myapi.json -o ./myapi-client

Related issues/PRs

May be related? https://github.com/swagger-api/swagger-codegen/issues/11052

Suggest a fix/enhancement

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the command shown in the issue and read CodegenConfigLoader.java and SwaggerCodegen.main from the stack trace to understand how available languages are registered. Check how existing Ruby or Java generators are exposed, then verify that Bash appears in the supported-language list and that the documented generation command completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, java
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.