Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Development/404452"
(→Phases) |
(→Phase 1: Additional Mapping Support) |
||
Line 11: | Line 11: | ||
== Phase 1: Additional Mapping Support == | == Phase 1: Additional Mapping Support == | ||
JSON Schemas in several places specify collections of data where the name of the element corresponds to a property in the object. This is something that is not currently supported by eclipselink's oxm/json binding layer. This would require adding support | JSON Schemas in several places specify collections of data where the name of the element corresponds to a property in the object. This is something that is not currently supported by eclipselink's oxm/json binding layer. This would require adding support | ||
+ | |||
+ | '''Example:''' | ||
+ | |||
+ | Mapping the list of properties on a schema. The name of the property is the key (or element) in the json schema, so this would require a variable-path mapping of some sort: | ||
+ | <div style="width:700px"> | ||
+ | <source lang="java"> | ||
+ | { | ||
+ | ... | ||
+ | {"properties": { | ||
+ | "firstName":{"type":"string"}, | ||
+ | "lastName":{"type":"string"} | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | </div> | ||
+ | Would need to be mapped to: | ||
+ | |||
+ | <div style="width:700px"> | ||
+ | <source lang="java"> | ||
+ | public class Schema { | ||
+ | ... | ||
+ | List<Property> properties; | ||
+ | } | ||
+ | </source> | ||
+ | </div> | ||
+ | <div style="width:700px"> | ||
+ | <source lang="java"> | ||
+ | public class Property { | ||
+ | String name; | ||
+ | String type; | ||
+ | } | ||
+ | </source> | ||
+ | </div> | ||
+ | |||
+ | Where name maps to the key/element name of the property entry. |
Revision as of 10:48, 8 April 2013
Planning: MOXy JSON Schema Generation
Currently EclipseLink supports generating XML Schemas from a JAXBContext. A feature will be added to generate JSON Schemas. At first this feature will be based on JAXB metadata and mappings, in the future this will be adapted to JSON-B metadata.
Phases
The development of this feature will need to be split into multiple phases. The current EclipseLink JSON support is insufficient to map to a json schema document. Additional enhancements will be required in order to generate these schemas.
Phase 1: Additional Mapping Support
JSON Schemas in several places specify collections of data where the name of the element corresponds to a property in the object. This is something that is not currently supported by eclipselink's oxm/json binding layer. This would require adding support
Example:
Mapping the list of properties on a schema. The name of the property is the key (or element) in the json schema, so this would require a variable-path mapping of some sort:
{ ... {"properties": { "firstName":{"type":"string"}, "lastName":{"type":"string"} } }
Would need to be mapped to:
public class Schema { ... List<Property> properties; }
public class Property { String name; String type; }
Where name maps to the key/element name of the property entry.