-
Notifications
You must be signed in to change notification settings - Fork 2
Customizing DyJest Editor Schema Datatype Definitions
The JSON schema editor uses the d3.js library tree object (d3.tree d3-jhierarcy) as root object. The tree object requires a specific json format for incoming data to build the visual graphic tree. Additional properties are defined that control the behavior of the editor elements. Using the subschema definition, a complex metadata schema can be divided into a number of subschemas (which are separate screens or pages of edit display) to simplify the editing process.
https://github.com/d3/d3-hierarchy/blob/master/README.md#tree
Using the d3 json format, the schema definition provide here is an extension of the format, providing for additional instructions need for editing functions. This is intended as a toolset that can be easily modified to support a wide variety of json meta data formats.
The following defines the set of attributes that can be specified in the json schema for d3 tree representation.
name - Node name (required) children - array (required for children nodes)
datatype - determines how the UI will treat the node, with the following datatypes:
- array – children are array elements – UI allows adding child objects
- bbox - allows spatial extent selection with MapBox widget, requires coordinate children in CKAN md_package format
- date – UI provides a simple jquery datepicker for date selection
- dictlist – UI provides a picklist as defined in jsonDictionary.json
- guid - guid type allows new guid creation, if it exists it cant be edited
- object - allows replication of children. If child object already exists it cant be created
- string - standard text object
- textarea - dynamic sized text area
- typeahead - allows typeahead based on jsonDictionary.json list
- dicturl – url of api for dictionary and typeahead lookups
- dictparams – json object to pass to api to qualify/filter search that can be based On the value of other nodes.
- dictChildren – A list of dependent of nodes used for lists and type aheads that are impacted if the current node is operated on.
- subschema – use the ref value to define a new schema and root point, providing a new view for current data set.
display - Alternate display name for field for improved readability.
package_ref - Mapping for md_package values to CKAN package dateset. Currently single value, will be a an object so multiple values can be specified. This allows the saves from the md_package edits to the CKAN package.
ref - The path relative to root for the field for both read and write. Defeault is md_package. Example - "metadataProperties.metadataContact.relatedAgent.agentRole.contactEmail" If the reference is to an Array “itemNode[]”, then the source will iterate and build an object for each array item.
required - indicates if field is required per metadata specification. true or false. This affects how connecting links are displayed for the element
root - alternate schema root - should only be placed on root object
rootType - type of root element, array or object.
rootKey - if array or object, key lookup of require root element..
value - data value, schema can contain a default value, populated when data is loaded
viewstate - collapse or expand for default behavior when opening.
hidden – Boolean.
Xoffset, yoffset – allows customization of node positions in the tree layout to improve the look and feel of a schema.