Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Generate GO clients when schema has enums on it #12430

Open
arturoguedez opened this issue Jul 27, 2024 · 1 comment
Open

Unable to Generate GO clients when schema has enums on it #12430

arturoguedez opened this issue Jul 27, 2024 · 1 comment

Comments

@arturoguedez
Copy link

Description

When attempting to generate GO clients from a schema that uses Enums, it fails with error :

15:58:49.856 [main] INFO  i.s.c.v.g.t.AbstractTypeScriptClientCodegen - Template folder: null
15:58:49.856 [main] INFO  i.s.c.v.g.t.AbstractTypeScriptClientCodegen - Template engine: io.swagger.codegen.v3.templates.HandlebarTemplateEngine@e98770d
15:58:49.877 [Thread-0] INFO  i.s.c.v.g.t.AbstractTypeScriptClientCodegen - Template folder: null
15:58:49.878 [Thread-0] INFO  i.s.c.v.g.t.AbstractTypeScriptClientCodegen - Template engine: io.swagger.codegen.v3.templates.HandlebarTemplateEngine@53ba3063
Exception in thread "Thread-0" java.lang.RuntimeException: Could not process model 'ASchemaName'.Please make sure that your schema is correct!
	at io.swagger.codegen.v3.DefaultGenerator.generateModels(DefaultGenerator.java:391)
	at io.swagger.codegen.v3.DefaultGenerator.generate(DefaultGenerator.java:793)
	at io.swagger.codegen.v3.cli.cmd.Generate.run(Generate.java:388)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "codegenModel.dataType" is null
	at io.swagger.codegen.v3.generators.DefaultCodegenConfig.fromModel(DefaultCodegenConfig.java:1466)
	at io.swagger.codegen.v3.generators.go.AbstractGoCodegen.fromModel(AbstractGoCodegen.java:565)
	at io.swagger.codegen.v3.DefaultGenerator.processModels(DefaultGenerator.java:1068)
	at io.swagger.codegen.v3.DefaultGenerator.generateModels(DefaultGenerator.java:380)
	... 3 more
Swagger-codegen version

Whichever version is in the docker image swaggerapi/swagger-codegen-cli-v3. 3.0.59?

Swagger declaration file content or url
openapi: 3.1.0

components:
  schemas:
    ASchemaName:
      type: string
      enum: [value1,value2,value3]
   
Command line used for generation

This works
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3 generate -i /local/simplest.yml -l javascript -o /local/out/go

This does not
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3 generate -i /local/simplest.yml -l go -o /local/out/go

Steps to reproduce

docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3 generate -i /local/simplest.yml -l go -o /local/out/go

Related issues/PRs

Unknown

Suggest a fix/enhancement
@kunwooy
Copy link

kunwooy commented Aug 14, 2024

Having same issue here. Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants