question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field with @JsonIgnore is shown in model schema

See original GitHub issue

I have this class, with ignored field ga, but the field is still shown in the model schema.

@AllArgsConstructor
@EqualsAndHashCode
public class GAV {

    @JsonIgnore
    @NonNull
    private final GA ga;

    @Getter
    @NonNull
    private final String version;

    @JsonCreator
    public GAV(@JsonProperty("groupId") String groupId,
            @JsonProperty("artifactId") String artifactId, @JsonProperty("version") String version) {
        this.ga = new GA(groupId, artifactId);
        this.version = version;
    }

    @JsonIgnore
    public GA getGA() {
        return ga;
    }

    public String getGroupId() {
        return ga.getGroupId();
    }

    public String getArtifactId() {
        return ga.getArtifactId();
    }

    @Override
    public String toString() {
        return getGroupId() + ":" + getArtifactId() + ":" + getVersion();
    }
}
{
  "ga": {
    "groupId": "string",
    "artifactId": "string"
  },
  "version": "string",
  "groupId": "string",
  "artifactId": "string"
}

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
webroncommented, Jan 7, 2016

For now you can use @ApiModelProperty(hidden=true) as a workaround.

0reactions
webroncommented, Jan 8, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignore fields from Java object dynamically while sending as ...
Show activity on this post. You can set @JsonIgnore of course on field, setter or getter like described here. And, if you want...
Read more >
Jackson @JsonIgnore, @JsonIgnoreProperties and ...
In this tutorial, I show you how to ignore certain fields when serializing an object to JSON using Jackson @JsonIgnore, @JsonIgnoreProperties and ...
Read more >
Jackson Ignore Properties on Marshalling - Baeldung
This tutorial will show how to ignore certain fields when serializing an object to JSON using Jackson 2.x.
Read more >
@JsonIgnore to ignore values on de-serializing from JSON to ...
Hi,. We have scenario where we need to ignore values on de-serializing from JSON to Java object ( or basically, it's a read...
Read more >
C# serialization with JsonSchema and System.Text.Json | endjin
But for an if constraint you will have to validate the if schema against the object, and then you know that the instance...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found