jaxb-v2 icon indicating copy to clipboard operation
jaxb-v2 copied to clipboard

Schemagen tool won't generate xsd if pojo contains java.time.LocalDate field

Open glassfishrobot opened this issue 9 years ago • 6 comments

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)]

glassfishrobot avatar Apr 16 '16 00:04 glassfishrobot

Reported by Andy_K

glassfishrobot avatar Apr 16 '16 00:04 glassfishrobot

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 ?

glassfishrobot avatar Jan 12 '17 05:01 glassfishrobot

slavb18 said: Only field-level annotations work (e.g. @XmlSchemaType(name="dateTime") placed directly on field

glassfishrobot avatar Jan 12 '17 05:01 glassfishrobot

Was assigned to yaroska

glassfishrobot avatar Apr 16 '16 00:04 glassfishrobot

This issue was imported from java.net JIRA JAXB-1096

glassfishrobot avatar Apr 24 '17 13:04 glassfishrobot

Only field-level annotations work (e.g. @xmlschematype(name="dateTime") placed directly on field

slavb18 avatar Sep 07 '17 10:09 slavb18