The current spec marks the travellers array as required in search-offers, despite travellers and profiles being equally valid types of travellers for a search. It should thus be possible to execute a search with only travellers, only profiles, or only travellingAssets, a combination of these – but never neither. At least one array needs to be present, and, if present, it needs to be non-empty.
A way to solve this in the spec would be to mark the arrays as required with anyOf:
anyOf:
- required: [ travellers ]
- required: [ profiles ]
- required: [ travellingAssets ]
To enforce non-empty arrays the other arrays should then get the same treatment as travellers:
travellers:
type: array
minItems: 1
maxItems: 10
items:
$ref: "#/components/schemas/individualTraveller"
profiles:
type: array
minItems: 1
maxItems: 10
items:
$ref: "#/components/schemas/userProfile"
travellingAssets:
type: array
minItems: 1
maxItems: 10
items:
$ref: "#/components/schemas/travellingAsset"
The current spec marks the
travellersarray as required insearch-offers, despitetravellersandprofilesbeing equally valid types of travellers for a search. It should thus be possible to execute a search with onlytravellers, onlyprofiles, or onlytravellingAssets, a combination of these – but never neither. At least one array needs to be present, and, if present, it needs to be non-empty.A way to solve this in the spec would be to mark the arrays as required with
anyOf:To enforce non-empty arrays the other arrays should then get the same treatment as
travellers: