Description
We're a bit ambiguous on how headerSchema
works. targetSchema
, for HTTP or anything similar that allows repeated headers and/or headers with multiple values (which are equivalent in HTTP), we require the hint value to always be an array, even if only one element. This is consistent with the JSON Encoding for HTTP Header Field Values draft that we cite.
However, headerSchema
does not clearly state such guidance, and I know I have often written it as assuming a single value (and therefore not an array).
This is fine for most circumstances, but if you want to require someone to pass multiple distinct values through the header, it is not possible to do so in a consistent way.
Should all schemas in headerSchemas
for HTTP (and similar systems) be of "type": "array"
and use "items"
(either the single schema or tuple syntax) for their contents?
The one implementation that I know of, https://github.com/mokkabonna/json-hyper-schema from @mokkabonna, does not do anything specific with headerSchema
, as that is not necessary for link construction.
The Getting Started With JSON Hyper-Schema, Part 2, from @Dashron, shows it as a schema describing a single value. I reviewed that article and either approved of it or was the person who told him that's how it worked :-P
My personal inclination is to say that it has to be an array schema and to use items
. It's a bit more boilerplate, but it is also more consistent, and covers a small but significant gap (e.g. what if I want to say that you have to supply both the "respond-async" preference and the "wait" preference if you supply either of them- those are two separate preferences that often work together).
Also paging @dlax, @philsturgeon