Closed l3fang closed 6 years ago
Thank you for reaching out to us and we'd like to first apoligize for not getting back to you sooner. We're closing out older issues since updates to the project may address the issue you opened or they may no longer be relevant. If you're still experiencing the problem, please reopen the issue - thanks!
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
By default, the structs generated by the swift generator does not have
in the constructor for each field. It seems this annotation is needed in order for Jackson to read the struct from json.
For example, I have the following class generated
package com.facebook.calligraphus.bucketing.shardmanager;
/* /
import com.facebook.swift.codec.ThriftConstructor; import com.facebook.swift.codec.ThriftField; import com.facebook.swift.codec.ThriftStruct; import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
import static com.google.common.base.Objects.toStringHelper;
@ThriftStruct("com.facebook.swift.shardmanager.SmcServiceTierScopesProp") public class SmcServiceTierScopesProp { @ThriftConstructor public SmcServiceTierScopesProp( @JsonProperty(value = "scopePrefix") <-- need this line @ThriftField(value=1, name="scopePrefix") final Map<String, String> scopePrefix ) { this.scopePrefix = scopePrefix; }
private final Map<String, String> scopePrefix;
@ThriftField(value=1, name="scopePrefix") public Map<String, String> getScopePrefix() { return scopePrefix; }
@Override public String toString() { return toStringHelper(this) .add("scopePrefix", scopePrefix) .toString(); } }
and I have the following json
This code throws in the readValue() line if the annotation is not there, because Jackson does not know how to construct the object without the annotation.
Any better suggestions here?