swagger-api / swagger-api/swagger-codegen

Generated Pojo should have @JsonInclude.Include.NON_NULL jackson annotation at field level and not just at class level.

Open
#11,053 0 comments 0 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

The POJO class generated by codegen does not have the functionality to add @JsonInclude.Include.NON_NULL at a field level. THere is a provision to add it at class level or project level. It would be great if we can add a flag in yaml configuration to include the above Jackson annotation in the POJO created

Swagger-codegen version

2.3.1

Swagger declaration file content or url
Command line used for generation

Java and spring

Steps to reproduce
Related issues/PRs
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 locating the Java and Spring POJO generation entry points, the YAML configuration handling, and the relevant generation tests. Reproduce generation with a YAML option and inspect the generated POJO fields; done means the requested field-level Jackson annotation is controlled by configuration and covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, tooling
Issue type
Feature
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.