Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micronaut Serde Jackson with @JsonUnwrapped and @JsonIgnoreProperties doesn't work #233

Closed
edeesis opened this issue Jun 12, 2022 · 0 comments

Comments

@edeesis
Copy link
Contributor

edeesis commented Jun 12, 2022

Expected Behavior

When using @JsonUnwrapped and @JsonIgnoreProperties, the properties listed should be ignored in the output.

Actual Behaviour

The properties are added to the JSON output. This seems to be because @SerIgnored is not checked in this loop: https://github.com/micronaut-projects/micronaut-serialization/blob/master/serde-support/src/main/java/io/micronaut/serde/support/serializers/SerBean.java#L214

Steps To Reproduce

Create a class with JsonUnwrapped and JsonIgnoreProperties

@Introspected
public class Foo {
	private final Bar bar;

	public Foo(Bar bar) {
		this.bar = bar
	}

	@JsonUnwrapped
	@JsonIgnoreProperties("ignored")
	public Bar getBar() {
		return bar;
	}
}

@Introspected
public class Bar {
	private final String output;
	private final String ignored;
	
	public Bar(String output, String ignored) {
		this.output = output;
		this.ignored = ignored;
	}

	public String getOutput() {
		return output;
	}

	public String getIgnored() {
		return ignored;
	}
}

Environment Information

No response

Example Application

https://github.com/edeesis/micronaut-problem-json/tree/fix-176

Version

3.0+ (tested on 3.5.1)

edeesis added a commit to edeesis/micronaut-serialization that referenced this issue Jul 6, 2022
edeesis added a commit to edeesis/micronaut-serialization that referenced this issue Jul 6, 2022
edeesis added a commit to edeesis/micronaut-serialization that referenced this issue Jul 6, 2022
edeesis added a commit to edeesis/micronaut-serialization that referenced this issue Jul 6, 2022
edeesis added a commit to edeesis/micronaut-serialization that referenced this issue Jul 6, 2022
edeesis added a commit to edeesis/micronaut-serialization that referenced this issue Jul 6, 2022
edeesis added a commit to edeesis/micronaut-serialization that referenced this issue Jul 6, 2022
edeesis added a commit to edeesis/micronaut-serialization that referenced this issue Jul 6, 2022
sdelamo added a commit to micronaut-projects/micronaut-problem-json that referenced this issue Sep 2, 2022
related to: Micronaut Serde Jackson with @JsonUnwrapped and @JsonIgnoreProperties doesn't work #233
see: micronaut-projects/micronaut-serialization#233

Compileation fails:

```
$ /problem-json/src/main/java/io/micronaut/problem/ProblemErrorResponseProcessor.java:136: error: Unwrapped property contains a property [type] that conflicts with an existing property of the outer type: io.micronaut.problem.ProblemErrorResponseProcessor$ThrowableProblemWithoutStacktrace. Consider specifying a prefix or suffix to disambiguate this conflict.
        final ThrowableProblem problem;
                               ^
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant