-
Notifications
You must be signed in to change notification settings - Fork 136
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
Instant serialized to wrong type #121
Comments
This is most likely since you have not registered module |
I have Is there anything else I have to do in order for this to work ? |
@kopax that should be all... what does the original Class (for which schema is generated) look like? I assume this is reproducible with 2.8.7? (all components, specifically |
My class look like this : public abstract class VersionId extends LongId implements Cloneable {
private static final Logger logger = LoggerFactory.getLogger(VersionId.class);
@Version
@NotNull
@JdbcType(BIGINT)
@Column(name = "VERSION")
private Integer version;
@CreatedDate
@NotNull
@JdbcType(TIMESTAMP)
@Column(name = "CREATED_DATE")
@JsonUnwrapped
private Instant createdDate;
@LastModifiedDate
@NotNull
@JdbcType(TIMESTAMP)
@JsonUnwrapped
@Column(name = "LAST_MODIFIED_DATE")
private Instant lastModifiedDate;
@CreatedBy
@Column(name = "CREATED_BY")
@NotNull
@JdbcType(BIGINT)
private Long createdById;
@Column(name = "LAST_MODIFIED_BY")
@LastModifiedBy
@JdbcType(BIGINT)
private Long lastModifiedById;
@JdbcType(BOOLEAN)
@Column(name = "ACTIVE")
@NotNull
private Boolean active = true;
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public Instant getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Instant lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public Long getCreatedById() {
return createdById;
}
public void setCreatedById(Long createdById) {
this.createdById = createdById;
}
public Long getLastModifiedById() {
return lastModifiedById;
}
public void setLastModifiedById(Long lastModifiedById) {
this.lastModifiedById = lastModifiedById;
}
public Boolean getActive() {
return active;
}
public void setActive(Boolean active) {
this.active = active;
}
} It is reproducible with 2.8.7. It sounds like the type string is wrong . |
One thing to note is that |
Using "createdDate": "2017-03-22T06:04:30.369Z", Instead of something like "createdDate": { "instant": "2017-03-22T06:04:30.369Z" } But the json schema is still invalid. Why does it show string while it has some object metadata ? |
@kopax That's not due to But looking back the original problem, this is weird:
where type of |
It's a jsonschema. I think it's jackson json that generate it. It's in a spring boot base application. (spring-data-rest) |
@kopax Another strange thing there is this:
which is not something Jackson's schema module outputs: it only supports v3 of schema spec. I also can not see anything in schema module that would actually output Perhaps |
version
2.8
Description
I have serialized the following entity :
And it's schema json :
I have test on http://www.jsonschemavalidator.net/ :
It appear jackson try to serialize a java
Instant
but the generated schema contain the wrong type "object" instead of "string"The text was updated successfully, but these errors were encountered: