Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

View Mediatype

bruth edited this page Feb 23, 2013 · 1 revision

Official mediatype: application/vnd.serrano.view+json

A JSON-based media type representing the output format corresponding to Avocado's DataView model. It is an array of facet nodes which define how the DataConcept or DataField is to be formatted.

Facet Node Format

{
    "concept": <concept>,
    "field": <field>,
    "order": <order>,
    "group": <group>,
    "lang": <lang>,
    "enabled": <enabled>,
    "warnings": [<warning>, [...]],
    "errors": [<error>, [...]]
}

concept

An integer representing the primary key identifier of the DataConcept the field is contained in. Clients that take advantage of concepts will likely need to supply this in order to correctly repopulate and/or organize data on the client.

Note, the field and concept are mutually exclusive, e.g. they cannot be used together.

field

The value can be:

  • An integer representing the primary key identifer for a DataField instance, e.g. 1
  • Period-delimited string representing a natural key for a DataField instance, e.g. "app.model.field"
  • An array of strings representing a natural key for a DataField instance, e.g. ["app", "model", "field"]

Note, the field and concept are mutually exclusive, e.g. they cannot be used together.

order

The desired ordering of the data, either "desc" (descending), "asc" (ascending), or null for no ordering.

group

A boolean that flags the data to be grouped by the concept or field.

lang

A read-only string that is a natural language representation of the node. This is annotated server-side and is used for information purposes and future validation purposes.

enabled

A boolean that is used during re-validation of the node on the server. If the node is no longer valid due to data changes or the field is not longer available, this flag is set to false. Clients may provide the option to override this auto-disabling policy for nodes with only warnings (not errors) by changing the flag to true. This is preferred over removing the flag to prevent the re-validation process happening subsequent times.

warnings

A read-only array of warnings that result during re-validation of the node. This typically includes changes to the data that caused the condition to be out of range such as a numerical condition that exceeds the upper bound of the data which would result in no results. These are considered warnings since there is no harm in applying the conditions.

errors

A read-only array of errors that result during re-validation of the node. Errors are different from warnings in that the node is considered broken and cannot be enabled. Clients may choose to remove the node from the tree or leave it for historical reasons.

Clone this wiki locally