Schemagen tool won't generate xsd if pojo contains java.time.LocalDate field
I've tried generate xsd schema for POJO contains java.time.LocalDate field.
In case, if this field isn't annotated, I've got a message:
java.time.LocalDate is a non-static inner class, and JAXB can't handle those.
But, I've created adapter extending XmlAdapter<String,LocalDate> for LocalDate class and then annotated necessary field with next annotation:
@XmlJavaTypeAdapter(value = ...utils.LocalDateAdapter.class)
In this case xsd also will not generated, and output will be just "null"
Environment
MS Windows 7
Affected Versions
[2.2.8 (JDK 8)]
Reported by Andy_K
slavb18 said: With package-level annotations (adaptors from com.migesok:jaxb-java-time-adapters)
@XmlJavaTypeAdapters(
{ @XmlJavaTypeAdapter(type = LocalDate.class, value = LocalDateXmlAdapter.class), @XmlJavaTypeAdapter(type = LocalTime.class, value = LocalTimeXmlAdapter.class), @XmlJavaTypeAdapter(type = LocalDateTime.class, value = LocalDateTimeXmlAdapter.class) }
) @XmlSchemaTypes(
{ @XmlSchemaType(name = "date", type = LocalDate.class), @XmlSchemaType(name = "time", type = LocalTime.class), @XmlSchemaType(name = "dateTime", type = LocalDateTime.class) }
)
Schemagen generates schema with all LocalDate, LocalTime, LocalDateTime class fields reset to xs:string. How to fix schema generation ?
slavb18 said: Only field-level annotations work (e.g. @XmlSchemaType(name="dateTime") placed directly on field
Was assigned to yaroska
This issue was imported from java.net JIRA JAXB-1096
Only field-level annotations work (e.g. @xmlschematype(name="dateTime") placed directly on field