Open vphilipnyc opened 4 years ago
Hey @vphilipnyc , have you actually checked this with any responses that have multiple 'legs'? I like your name better than using the verbose OrderLegCollection - that was generated based on the schema, though, and unless we annotate the pojo fields with an explicit Jackson name it won't auto deserialize it if the JSON itself uses 'OrderLegCollection' as the wrapper.
Unfortunately, I haven't tested many complex orders (I don't understand them :/) so I'm not sure I've had any JSON being returned with a OrderLegCollection that's filled in.
@studerw , I am able to iterate through orderLegs
with no issue, though I must admit that my actual orders only seem to have one leg at the moment. On my Thymeleaf front end, it looks like:
<th:block th:each="orderLeg: ${order.orderLegs}">
<p th:text="${orderLeg?.instrument?.symbol} + ': ' +${orderLeg?.instruction} + ', Qty: '+${#numbers.formatDecimal(order?.quantity, 0, 0)}">[description]</p>
</th:block>
And it prints the values just fine. I just haven't placed any orders with multiple legs recently, but can look out for it if you'd prefer to hold off merging this PR. Jackson will just use the name you specify though.
Aside, I also use the simpler:
@JsonProperty("legId")
String id;
Since the class is called OrderLeg
.
Leaves JSON property in place. Feel free to not merge this PR if this will cause serialization issues.