swagger-api / swagger-api/swagger-codegen

Composed body parameter causes null pointer exception

Open
#4,798 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature: Composition / Inheritance help wanted Issue: Bug Server: Java
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Defining an api operation with composite parameter causes a ComposedModel to be generated. The swagger-codegen then does not handle that type in class DefaultCodegen function fromParameter.
Resulting in a null pointer exception.

Swagger-codegen version

2.2.2-SNAPSHOT

Swagger declaration file content or url

Use Animal object from the swagger spec as body object in the operation.

Command line used for generation

java -jar swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -l jaxrs-cxf - -i api.json

Steps to reproduce
Related issues
Suggest a Fix

Implement composite support for body parameter

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 in DefaultCodegen.fromParameter and reproduce the failure with the Animal object in api.json using the jaxrs-cxf command shown. Trace how the generated ComposedModel is handled as a body parameter; done means generation completes without a null pointer exception and composite body parameters are supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.