OpenProposal 3.0 JSON Schema Unofficial

Decision records · Selectable and settable fields

D-011 What makes a min / max pair a range? May it give one bound only, or none, and must min be at most max?

Gap Decision 15 on the supporting page of #121. Cited on main and with the open PRs.

What the schemas do

A range gives one bound or both, never neither, and min is at most max.

Options

  • one-or-both-ordered Chosen

    A range gives one bound or both, never neither, and min is at most max.

  • both-ordered

    A range gives both bounds, and min is at most max.

  • as-written

    Both bounds are optional and unordered, so {} and { min: 5, max: 1 } are ranges.

Why

§ 3.2 calls the pair "a numeric or date range", and its "min / max" reads as either bound or both. A range with one bound, such as "at most 10", is a range in the ordinary sense, and nothing in the specification rules it out. A pair with no bound declares nothing, which § 3.2 forbids for a settable field ("MUST declare its bounds"), and in frequency_cap's max it would leave the buyer nothing to set within. A pair whose min is above its max holds no value at all, so the seller's bounds would admit nothing; no example writes one. The form that carries the pair is Range: it has minProperties: 1 in its schema, and the order is the rule constructor:Range:ordered, since JSON Schema can't compare two members.

What we ask the specification to state

State that a min / max range gives one bound or both, and that min is at most max. Also say how an inline object, such as frequency_cap's { min, max }, marks a member as required or optional. No inline object in the specification does.

The specification lines it rests on

Each line is quoted as the record pins it. Expand an item to read the quote.

main

  • § 3.2, a requirement L158 at 44dfaaf
    Every field marked settable MUST declare its bounds: either allowed[] (an enumerated set) or min / max (a numeric or date range).
  • § 5.5, the frequency_cap row's description: the inline object L261 at 44dfaaf
    { max: { min, max }, period, basis: device | household | listener }

With the open PRs

  • § 3.2, a requirement L151 on main at 981a74e
    Every field marked settable MUST declare its bounds: either allowed[] (an enumerated set) or min / max (a numeric or date range).
  • § 5.5, the frequency_cap row's description: the inline object L254 on main at 981a74e
    { max: { min, max }, period, basis: device | household | listener }

What it shapes

main: FrequencyCap, FrequencyCap.basis, FrequencyCap.max, FrequencyCap.period

With the open PRs: FrequencyCap, FrequencyCap.basis, FrequencyCap.max, FrequencyCap.period

The record's YAML file