I am using Java Immutables for my request/response classes, which looks something like this:
@JsonDeserialize(builder = ImmutableMyRequest.Builder.class)
@Immutable
public interface MyRequest {
@Nullable String getA();
@NotNull String getB();
...
}
Now i need to add a new field to my request:
@JsonDeserialize(builder = ImmutableMyRequest.Builder.class)
@Immutable
public interface MyRequest {
@Nullable String getA();
@NotNull String getB();
@Nullable String getC(); // Edit
...
}
In my understanding, this should not break the compatibility and the older clients should simply ignore the new fields, but when i use the older version with the new request, it fails:
Unexpected status. Expected: 200. Actual: 400. Response: InboundJaxrsResponse{context=ClientResponse{method=POST, uri=http://some.url.here, status=400, reason=Bad Request}}
I am using javax.ws.rs.client.Invocation.Builder
to post my requests.
Any help here?