Extension:VisualData/Schema Builder

From mediawiki.org

Schema Builder[edit]

VisualData' Schema Builder is a complete UI able to create compliant json-schema vocabulary, supporting properties, sub-objects, items (arrays), content blocks, and of course the basic json-schema types and string formats. Compared to other solutions like jsonSchemaCreator it offers a more intuitive creation/editing of nested properties/sub-schemas and a better inteFgration with Mediawiki OOUI. However, it currently provides an incomplete support compared to the entire features of the json-schema specifications, the most important still to be added being the directives oneOf, anyOf and support for the $ref keyword.


The Schema Builder is accessible either through the special page "Manage Schemas" (provided that the logged-in user has the proper permissions) or through a dropdown menu from the tab "Edit data".



(CRUD datatable by which to create/edit/rename/delete schemas)



(dropdown to manage schemas when user has permissions "visualdata-canmanageschemas")


The Schema Builder allows to create fields, multiple fields, subitems, multiple subitems (arbitrarily nested) and content-blocks, and to rearrange them. It produces json-schema compliant schemas that will be saved in the VisualDataSchema namespace.


Fields created through the interface can be defined through a large set of options, like label, help message, visibility, type, preferred input (based on type), format, required, default value, value formula, and more.

Wikitext can be inserted anywhere (in content-blocks, label and help elements) therefore the resulting form is fully customizable.



The list of widgets available in the dropdown "Preferred input" contains 3 different sets of widgets listed below and reflects the type and format actually selected, plus whether the field is multiple or not. Therefore the widgets shown in the dropdown based on other settings are always less than the total available widgets.



Each input widget is in turn fully customizable through a dedicated interface, so most of the native configuration settings of both OOUI widgets and Mediawiki's OOUI widgets are accessible.



If accessed through the Edit data tab or the edit icon on the header of the form (provided that the logged-in user has the proper permissions) all the changes to a schema performed through the SchemaBuilder are interactively reflected in the related form for a fast schema/form prototyping.

This is a demo of a form produced by the SchemaBuilder with various available inputs.


Available widgets[edit]

The SchemaBuilder offers 3 different sets of widgets:



  • custom widgets like:


Editing of schema or property names[edit]

Since version 1.0.5 VisualData supports deletion and rename of schemas and properties keeping in synch the data in related articles. After editing a schema or property name involving an update of article data, the SchemaBuilder will show the following message:

If the operation is confirmed ensure to run

php maintenance/runJobs

in the MW installation folder to complete the operation.


Available options[edit]

Here is a table with all currently available options for each component:

option component description
name schema, content block, field, subitem/subschema unique name of the component. Should not be changed unless the json-data and parser functions will be updated
title schema, field, subitem/subschema title of the component. Can be wikitext
description schema, field, subitem/subschema description of the component. Can be wikitext
content block content block content of the content-block element (can be wikitext)
label field field label (can be wikitext)
help-message field field help-message (can be wikitext)
visibility field visible, condition, hidden, create only
type field string, number, integer, boolean
format field color, date, datetime, datetime-local, email, month, password, number, range, tel, text, textarea, time, url, week
multiple field boolean
preferred input field see below (it depends on type, format and multiple)
required field boolean
default value field can be wikitext, supports multiple values
value formula field string, template or parser function applied to the value before submission. An "untrasformed" is value among json-data to avoid recursive transformations
can be null option widgets null option for select widgets
options (as defined) option widgets user-defined options for select widgets
wikilist option widgets options retrieve from a wikilist (inserting an article title)
options label formula option widgets string, template or parser function applied to the label of the menu options
ask query lookup widgets conditions of the query
schema lookup widgets schema to be queried
printouts lookup widgets properties to be queried
option value formula lookup widgets string, template or parser function applied to the value of the menu options
multiple-items subitem/subschema whether the subitem/subschema can be instantiated (i.e. the container with all the related fields inserted multiple times)
layout subitem/subschema layout of the subitem/subschema, can be section (default) or horizontal
min items items (arrays) minimum number of required items
max items items (arrays) maximum number of required items
unique items items (arrays), for fields whether the input values are unique


See also[edit]