liveBook · Manning

Required keyword

As explained in Data-Oriented Programming: Reduce software complexity

A required array is a JSON Schema keyword value listing the property names that an object must contain.

A required array names the properties an object must contain. Object properties are optional by default, so add each mandatory field explicitly. section 7.2 section 7.3

Make a search request complete

A search request needs both title and fields: {"required": ["title", "fields"]}. A request with title misspelled as tilte fails validation because the required title property is absent.

The same pattern works inside nested schemas. A book object can require title and available while leaving subtitle, ISBN variants, and other properties optional.

How Data-Oriented Programming: Reduce software complexity covers it

How deep it goes
Defines the array form and demonstrates request, response, and database schemas without descending into validator internals.
Examples
Uses search requests, book responses, and database responses to show required fields in flat and nested objects.
What it assumes
Assumes familiarity with JSON objects and schemas while teaching that unspecified object properties remain optional.
What you can do after
Diagnose invalid objects by checking whether every property named in the required array is present.
How it connects
Connects required properties with JSON Schema, object properties, data validation, and schema composition.

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.