-
Notifications
You must be signed in to change notification settings - Fork 240
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
Wrong property parsing #617
Comments
Originally typescript-generator only used Jackson's The problem here is really curious. Obviously Jackson considers public static class DisplaySeason {
private String value;
public void setupSeason(String season) {
value = season;
}
}
public static void main(String[] args) throws JsonProcessingException {
final ObjectMapper objectMapper = new ObjectMapper();
final String json = "{\"upSeason\":\"abc\"}";
final DisplaySeason displaySeason = objectMapper.readValue(json, DisplaySeason.class);
System.out.println(displaySeason.value);
} This code parses JSON, reads Apart from annotating |
I realised that at least Jackson is consistent with Java Beans API. If I try following code: BeanInfo beanInfo = Introspector.getBeanInfo(DisplaySeason.class);
Stream.of(beanInfo.getPropertyDescriptors()).forEach(System.out::println); it also prints property |
Actually there is one difference between Jackson and Java Beans. When method return type is |
Another possibility how to exclude setter methods is to configure generateTypeScript {
jsonLibrary = 'jackson2'
jackson2Configuration = [
setterVisibility: 'NONE'
]
} |
After some release my method
was treated as property:
I temporary fix it by marking
@JsonIgnore
. Is there any better solution?The text was updated successfully, but these errors were encountered: