liveBook · Manning

Items keyword

As explained in Data-Oriented Programming: Reduce software complexity

The JSON Schema keyword whose value specifies the schema for elements of an array.

An array typed as "array" is only a start. The items keyword makes validation useful by specifying the schema every array element must satisfy. section 7.2

Constrain search fields

For a search request, items can require each fields element to be a string. It can then become stricter by using enum to allow only supported field names. section 7.2

How Data-Oriented Programming: Reduce software complexity covers it

How deep it goes
Defines the element-schema role and demonstrates string and enum constraints, stopping short of broader array validation details.
Examples
Uses a search request whose fields array contains title, weight, and number_of_pages.
What it assumes
Assumes familiarity with JSON objects, schema type declarations, and arrays while building from an array property.
What you can do after
Apply it to validate array elements as strings or as members of an allowed enumeration.
How it connects
Connects arrays with JSON Schema, enum, required properties, and validation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data-Oriented Programming: Reduce software complexity. The section links point to the parts of the book it draws on.