Skip to content

JSON serialization adds field #48104

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

Open
macakmujo opened this issue May 28, 2025 · 2 comments
Open

JSON serialization adds field #48104

macakmujo opened this issue May 28, 2025 · 2 comments
Labels
area/jaxb kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.

Comments

@macakmujo
Copy link

macakmujo commented May 28, 2025

Describe the bug

While serializing JSON responseI got doucle properties isEnd and end in response, when I renamed property it started to work fine

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import lombok.*;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Dto")
@XmlAccessorType(XmlAccessType.NONE)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(description = "Dto request")
public class Dto  {
    @XmlElement(name = "code")
    @Schema(required = true, description = "", example = "")
    private String code;

    @XmlElement(name = "isEnd")
    @Schema(required = true, description = "isEnd", example = "true")
    private boolean isEnd;
}

response is generated like this

@NoArgsConstructor
public class GetCodesResponder implements IConcreteResponder<NoData, List<Dto>> {

    public List<Dto> respond(NoData request) {
            val codes = Service.findAll().stream().toList();
            return codes.stream().map(Service.class::cast)
                    .map(ServiceMapper.INSTANCE::mapping)
                    .toList();
    }
}

Expected behavior

response has single property serialized

Actual behavior

response has double properties isEnd and end in serialization output

How to Reproduce?

create response with same properties as in Dto class

Output of uname -a or ver

Linux T3000449 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

java 17

Quarkus version or git rev

3.1.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@macakmujo macakmujo added the kind/bug Something isn't working label May 28, 2025
Copy link

quarkus-bot bot commented May 29, 2025

/cc @gsmet (jaxb)

@geoand
Copy link
Contributor

geoand commented May 29, 2025

Given the information provided, it's really hard to understand what the issue is, so we are going to need a reproducer if we are to be able to figure it out.

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/jaxb kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.
Projects
None yet
Development

No branches or pull requests

2 participants