JSON data source
The JSON data source provides information about what REST client, REST call and path expressions to use.
|
The JSON data source is part of the If you work with the Magnolia 5 UI framework, see Content connector instead. |
| The JSON data source, which provides the ability to use REST clients in the UI, is a DX Core feature that is not available in the Community Edition. |
Example definition
datasource:
name: rest
$type: jsonDatasource
restClient: countries
restCall: allCountries
jsonPathExpressions:
itemId: '$.name'
items: '$.*'
describeBy: '$.name'
List of properties
| Property | Description | ||
|---|---|---|---|
|
required Use |
||
|
required Specifies the REST client to be used. |
||
|
required REST call configuration. Must use the entity class |
||
|
required Simplifies data selection from REST responses. See info.magnolia.rest.ui.JsonPathExpressionsDefinition for more information. |
||
|
required Unique identifier of the item. |
||
|
required List of items to be used by the data provider. |
||
|
optional Describes (in the status bar) the selected item. |
||
|
optional Provides preview of the selected item. |
||
|
optional Mapping to get values using path expressions. Useful for values deep in the hierarchy. |
||
|
optional, default is Name of the data source. |
||
|
optional Defines a pagination strategy for the list presenter. Must implement the info.magnolia.rest.ui.pagination.PaginationStrategyDefinition interface.
|
Data source components
Module component mappings can be defined in the context of the current data source (a component section should have an id in the form of <id>datasource-<ds-name></id>, where <ds-name> is configured in the definition).
| Type | Implementation | Description |
|---|---|---|
|
|
Helper class for making calls to REST clients. |
|
|
Data provider implementation using REST client. |
|
|
Converts path to actual item and back. |
|
|
Provides preview of selected item (for example, content of a binary node or link to an image). |
|
|
Reads and writes properties from/to item in form. |
|
|
Provides delegates required by select fields. |
|
|
Checks whether the REST call is available. |
|
|
Factory class that creates/initializes info.magnolia.rest.ui.field.linkfield.JsonLinkFieldDefinition. |
|
|
Factory class that creates/initializes info.magnolia.rest.ui.field.comboboxfield.JsonComboBoxFieldDefinition. |
|
|
Displays description for selected item(s) at the bottom of app. |
|
|
Displays items as list. |
<components>
<id>datasource-rest</id>
<component>
<type>info.magnolia.rest.ui.RestClientInvoker</type>
<implementation>info.magnolia.rest.ui.RestClientInvoker</implementation>
<scope>singleton</scope>
</component>
<component>
<type>info.magnolia.rest.ui.JsonDataProvider</type>
<implementation>info.magnolia.rest.ui.JsonDataProvider</implementation>
</component>
<component>
<type>info.magnolia.ui.datasource.ItemResolver</type>
<implementation>info.magnolia.rest.ui.JsonItemResolver</implementation>
</component>
<component>
<type>info.magnolia.ui.contentapp.browser.preview.PreviewProvider</type>
<implementation>info.magnolia.rest.ui.preview.JsonPreviewProvider</implementation>
</component>
<component>
<type>info.magnolia.ui.datasource.PropertySetFactory</type>
<implementation>info.magnolia.rest.ui.JsonPropertySetFactory</implementation>
</component>
<component>
<type>info.magnolia.ui.field.SelectFieldSupport</type>
<implementation>info.magnolia.rest.ui.JsonSelectFieldSupport</implementation>
</component>
<component>
<type>info.magnolia.rest.ui.HealthCheck</type>
<implementation>info.magnolia.rest.ui.HealthCheck</implementation>
</component>
<type-mapping>
<type>info.magnolia.rest.ui.field.factory.JsonLinkFieldFactory</type>
<implementation>info.magnolia.rest.ui.field.factory.JsonLinkFieldFactory</implementation>
</type-mapping>
<type-mapping>
<type>info.magnolia.rest.ui.field.factory.JsonComboBoxFieldFactory</type>
<implementation>info.magnolia.rest.ui.field.factory.JsonComboBoxFieldFactory</implementation>
</type-mapping>
<type-mapping>
<type>info.magnolia.ui.contentapp.browser.StatusBar</type>
<implementation>info.magnolia.rest.ui.JsonStatusBar</implementation>
</type-mapping>
<type-mapping>
<type>info.magnolia.ui.contentapp.browser.ListPresenter</type>
<implementation>info.magnolia.rest.ui.JsonListPresenter</implementation>
</type-mapping>
</components>