@openaddresses/batch-schema 10.26.0 → 10.28.1

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.
@@ -24,6 +24,17 @@ describe('Schema Server', () => {
24
24
  res.json({ ok: true });
25
25
  });
26
26
 
27
+ await schema.get('/secured', {
28
+ description: 'Route with operation level security',
29
+ security: [
30
+ { bearerAuth: [] },
31
+ { layerAuth: ['search:read'] }
32
+ ],
33
+ res: Type.Object({ ok: Type.Boolean() })
34
+ }, async (_, res) => {
35
+ res.json({ ok: true });
36
+ });
37
+
27
38
  await schema.post('/json-only', {
28
39
  description: 'Backwards compatible JSON body',
29
40
  body: Type.Object({
@@ -113,6 +124,11 @@ describe('Schema Server', () => {
113
124
  query: false,
114
125
  res: true
115
126
  },
127
+ 'GET /secured': {
128
+ body: false,
129
+ query: false,
130
+ res: true
131
+ },
116
132
  'POST /json-only': {
117
133
  body: true,
118
134
  query: false,
@@ -219,6 +235,18 @@ describe('Schema Server', () => {
219
235
  assert.strictEqual(body.paths['/schema'].get.deprecated, false);
220
236
  });
221
237
 
238
+ it('GET: api/openapi emits operation level security', async () => {
239
+ const res = await fetch('http://localhost:2000/api/openapi');
240
+ const body = await res.json();
241
+
242
+ assert.strictEqual(res.status, 200, 'http: 200');
243
+ assert.deepStrictEqual(body.paths['/secured'].get.security, [
244
+ { bearerAuth: [] },
245
+ { layerAuth: ['search:read'] }
246
+ ]);
247
+ assert.strictEqual(body.paths['/legacy'].get.security, undefined);
248
+ });
249
+
222
250
  it('POST: /json-only with valid JSON body (backwards compat)', async () => {
223
251
  const res = await fetch('http://localhost:2000/api/json-only', {
224
252
  method: 'POST',