Skip to content

Pojo to ignore null value fields #6488

@dougbacelar

Description

@dougbacelar

Description

I have an issue where I need the pojo to ignore null value fields.

The same issue is described by this guy here

I was wondering if it is possible to make this work(some kind of setting or parameter), without having to edit the swagger-codegen code, like the guy above did.

If it is not possible, shouldn't this be the default behaviour? Shouldn't the pojo ignore null value fields by default?

Guess I would expect @JsonInclude(JsonInclude.Include.NON_NULL) to be populated on the pojo by default, do I have the wrong idea?

Not sure if it is the right file, but I checked pojo.mustache and it doesn't seem to have anything doing that.

Swagger-codegen version

2.3.0

Related issues/PRs

I found this issue but I am not sure if it is related:
#1413

Ps

I am new to swagger-codegen so I apologize if this does not make sense.

I solved my problem for the time being by adding spring.jackson.serialization-inclusion=non_null, but I would rather have a class-level solution, instead of project-level.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions