OpenAPITools / OpenAPITools/openapi-generator
[BUG] Null Reference Exception when using --model-name-suffix for fsharp-giraffe-server generator
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
When running this commande openapi-generator generate -i api.yml -g fsharp-giraffe-server --dry-run --model-name-suffix "Dto" I get the following exception:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.util.Map.put(Object, Object)" because "models" is null
at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:512)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:875)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:441)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
When I run it with any other generator, I don't get the exception:
openapi-generator generate -i api.yml -g aspnetcore --dry-run --model-name-suffix "Dto"
When I run it without --model-name-suffix, I don't get the exception:
openapi-generator generate -i api.yml -g fsharp-giraffe-server --dry-run
@nmfisher Could it be that this option is not supported yet for the F# generator?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the command with the fsharp-giraffe-server generator and --model-name-suffix, then trace the failure from org.openapitools.codegen.DefaultGenerator.generateModels at line 512 through the generator configuration. Compare this path with the aspnetcore run and the no-suffix run. Done means the F# generator no longer raises the NullPointerException, or its unsupported-option behavior is explicitly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp, java
- Domain
- api, backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100