@tillhub/schemas 6.455.0 → 6.456.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -162,12 +162,12 @@ module.exports = oneOf({
|
|
|
162
162
|
}
|
|
163
163
|
},
|
|
164
164
|
opening_hours_exceptions: {
|
|
165
|
-
description: 'Additive Open or Closed exceptions over a date range, optionally limited to selected weekdays. Closed is full day only. 0 = Monday … 6 = Sunday.',
|
|
165
|
+
description: 'Additive Open or Closed exceptions over a date range, optionally limited to selected weekdays. Closed is full day only. 0 = Monday … 6 = Sunday. `from` and `to` are required keys on every item: omit neither. Open all-day is `from: null` and `to: null` (both present). Open specific hours requires both as HH:mm. Closed requires `from: null` and `to: null`.',
|
|
166
166
|
type: 'array',
|
|
167
167
|
items: {
|
|
168
168
|
type: 'object',
|
|
169
169
|
additionalProperties: false,
|
|
170
|
-
required: ['type', 'start_date', 'end_date'],
|
|
170
|
+
required: ['type', 'start_date', 'end_date', 'from', 'to'],
|
|
171
171
|
properties: {
|
|
172
172
|
type: {
|
|
173
173
|
type: 'string',
|
|
@@ -190,12 +190,14 @@ module.exports = oneOf({
|
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
192
|
from: {
|
|
193
|
+
description: 'Required. Open all-day: must be null together with `to` (the key must still be present). Open specific hours: HH:mm start, with `to` also set. Closed: always null.',
|
|
193
194
|
oneOf: [
|
|
194
195
|
{ type: 'null' },
|
|
195
196
|
{ type: 'string', pattern: '^([01]\\d|2[0-3]):[0-5]\\d$' }
|
|
196
197
|
]
|
|
197
198
|
},
|
|
198
199
|
to: {
|
|
200
|
+
description: 'Required. Open all-day: must be null together with `from` (the key must still be present). Open specific hours: HH:mm end, with `from` also set and earlier than `to`. Closed: always null. Omitting this key is invalid and is not treated as all-day.',
|
|
199
201
|
oneOf: [
|
|
200
202
|
{ type: 'null' },
|
|
201
203
|
{ type: 'string', pattern: '^([01]\\d|2[0-3]):[0-5]\\d$' }
|
|
@@ -226,6 +228,7 @@ module.exports = oneOf({
|
|
|
226
228
|
required: ['type']
|
|
227
229
|
},
|
|
228
230
|
then: {
|
|
231
|
+
required: ['from', 'to'],
|
|
229
232
|
properties: {
|
|
230
233
|
from: { type: 'null' },
|
|
231
234
|
to: { type: 'null' },
|
|
@@ -244,12 +247,15 @@ module.exports = oneOf({
|
|
|
244
247
|
then: {
|
|
245
248
|
oneOf: [
|
|
246
249
|
{
|
|
250
|
+
description: 'Open all day: from and to must both be present and null (00:00–23:59). A break may sit strictly inside that window. Omitting either key is not all-day.',
|
|
251
|
+
required: ['from', 'to'],
|
|
247
252
|
properties: {
|
|
248
253
|
from: { type: 'null' },
|
|
249
254
|
to: { type: 'null' }
|
|
250
255
|
}
|
|
251
256
|
},
|
|
252
257
|
{
|
|
258
|
+
description: 'Open specific hours: from and to must both be present as HH:mm.',
|
|
253
259
|
properties: {
|
|
254
260
|
from: { type: 'string' },
|
|
255
261
|
to: { type: 'string' }
|
package/package.json
CHANGED
|
@@ -47,6 +47,16 @@ test('Configurations: opening_hours_exceptions accepts Open all-day, Open hours,
|
|
|
47
47
|
to: null,
|
|
48
48
|
reason: 'Sunday brunch all day'
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
type: 'open',
|
|
52
|
+
start_date: '2026-12-21',
|
|
53
|
+
end_date: '2026-12-21',
|
|
54
|
+
from: null,
|
|
55
|
+
to: null,
|
|
56
|
+
break_from: '15:00',
|
|
57
|
+
break_to: '16:00',
|
|
58
|
+
reason: 'All day with afternoon break'
|
|
59
|
+
},
|
|
50
60
|
{
|
|
51
61
|
type: 'open',
|
|
52
62
|
start_date: '2026-07-02',
|
|
@@ -93,6 +103,40 @@ test('Configurations: opening_hours_exceptions rejects Closed with specific hour
|
|
|
93
103
|
t.end()
|
|
94
104
|
})
|
|
95
105
|
|
|
106
|
+
test('Configurations: opening_hours_exceptions rejects omitted Open from/to keys', function (t) {
|
|
107
|
+
t.plan(1)
|
|
108
|
+
const valid = validateUpdatePayload({
|
|
109
|
+
reservations: {
|
|
110
|
+
opening_hours_exceptions: [
|
|
111
|
+
{
|
|
112
|
+
type: 'open',
|
|
113
|
+
start_date: '2026-12-20',
|
|
114
|
+
end_date: '2026-12-20'
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
t.notOk(valid, 'Open from/to keys are required; omitted keys are not all-day')
|
|
120
|
+
t.end()
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
test('Configurations: opening_hours_exceptions rejects omitted Closed from/to keys', function (t) {
|
|
124
|
+
t.plan(1)
|
|
125
|
+
const valid = validateUpdatePayload({
|
|
126
|
+
reservations: {
|
|
127
|
+
opening_hours_exceptions: [
|
|
128
|
+
{
|
|
129
|
+
type: 'closed',
|
|
130
|
+
start_date: '2026-01-01',
|
|
131
|
+
end_date: '2026-01-01'
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
t.notOk(valid, 'Closed from/to keys are required and must be null')
|
|
137
|
+
t.end()
|
|
138
|
+
})
|
|
139
|
+
|
|
96
140
|
test('Configurations: opening_hours_exceptions rejects mixed Open from/to', function (t) {
|
|
97
141
|
t.plan(1)
|
|
98
142
|
const valid = validateUpdatePayload({
|