swagger-api / swagger-api/swagger-codegen
Exception while running generate on validated format in multiple languages
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
While trying to generate code for a valid swagger definition I get the following exception:
[main] INFO io.swagger.parser.Swagger20Parser - reading from /Users/patrick/Coginitive/Face/FaceSwagger.json
[main] INFO io.swagger.codegen.ignore.CodegenIgnoreProcessor - No .swagger-codegen-ignore file found.
Exception in thread "main" java.lang.RuntimeException: Could not process operation:
Tag: Tag {
name: default
description: null
externalDocs: null
extensions:{}}
Operation: 563879b61984550f30395236
Resource: post /detect
Definitions: {}
Exception: null
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:932)
at io.swagger.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:811)
at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:431)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:746)
at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: java.lang.NullPointerException
at io.swagger.codegen.DefaultCodegen.fromParameter(DefaultCodegen.java:2585)
at io.swagger.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:2213)
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:881)
... 5 more
I get the same exception whether I try to generate code for Swift 4 or C#, I have not tried any other language.
Swagger-codegen version
Using Swagger 2.3.1 on a Mac installed via Homebrew.
Swagger declaration file content or url
Using the swagger API definition for the following API:
https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236
I did validate the definition.
Command line used for generation
swagger-codegen generate -i -l csharp -o
swagger-codegen generate -i -l swift4 -o
Steps to reproduce
Execute the command above against the supplied definition.
Related issues/PRs
Suggest a fix/enhancement
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
Start by running the reported swagger-codegen generate command against the linked Cognitive Services definition for csharp and swift4. Trace the failure through SwaggerCodegen.main, Generate.run, DefaultGenerator.java, and DefaultCodegen.fromParameter. Done means both generation commands process the valid definition without the reported NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, java, openapi, swift
- Domain
- backend-api-design, cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100