Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
"properties": {
	"baseUrl": {
		"type": "string",
		"description": "The base url queries built with this widget will go to"
	},
	"results": {
		"$ref": "#/$defs/results"
	},
	"filters": {
		"$ref": "#/$defs/filters"
	},
	"sort": {
		"$ref": "#/$defs/sort"
	},
	"configurableProperties": {
		"$ref": "#/$defs/configurableProperties"
	}
}

As you can see, some of the properties may be very simple fields, such as baseUrl, and some of the properties may require more complicated objects. In this case, most of the top-level properties require more detailed information, so to keep the JSON schema as efficient and flat as possible, this information is split out into a "$defs" section. 

Let's look next at the "results" property:

Code Block
"results": {
	"type": "object",
	"title": "Results",
	"description": "Contains all the information the dashboard needs to fetch and parse results",
	"additionalProperties": false,
	"required": ["columns"],
	"properties": {
		"columns": {
			"type": "array",
			"items": { "$ref": "#/$defs/resultColumn" }
		}
	}
},
"resultColumn": {
	"type": "object",
	"title": "Result column",
	"description": "Describes the columns to be made available in the output",
	"additionalProperties": false,
	"required": ["accessPath", "name", "valueType"],
	"properties": {
		"accessPath": {
			"type": "string",
			"description": "a string defining the path to the specified object property"
		},
		"label": {
			"type": "string",
			"description": "an optional string prescribing the display label of the field"
		},
		"name": {
			"type": "string",
			"description": "a string defining the name of the property for this column"
		},
		"valueType": {
			"type": "string",
			"enum": ["String", "Integer", "Float", "Boolean", "Date"],
			"description": "a string defining the type of property we are displaying"
		}
	}
}

All of this information is to specify that the shape for this property must look like the following:

Code Block
results: {
	columns: [
		{
			accessPath: "path.to.property.on.object",
			name: "name of property",
			label: "display label of field, can be overwritten",
			valueType: String
		},
		...
	]
}