openvibers/openvibe.tools Commits
/openapi.json redirects to the gateway's own document (SEO-3) (#207)
Changes
@@@ -34,6 +34,8 @@ const { createGuard, TRUST_PROXY } = require('../../_shared/guard');const { createNetworkSender } = require('openvibe-sdk/account-data'); // ADR-033: Tools' part of an export, back to Networkconst app = express();++// SEO-3: /openapi.json, where agents look first, is the gateway's own document (server/openapi.js).++app.get('/openapi.json', (req, res) => res.redirect(308, '/api/v1/openapi.json'));// Network's sign-out-everywhere cutoffs for every Tools app (./revocation-events.js): before any body parser.app.post('/internal/events', ...require('./revocation-events').handler());// What this deploy runs (ADR-016); the shared navbar's release-watch polls it on every tool host.@@@ -20,4 +20,7 @@ assert.strictEqual(ids.length, new Set(ids).size, 'operation ids are unique');assert.ok(doc.paths['/api/v1/tools'] && doc.paths['/api/v1/jobs/{id}/events'], 'registry and jobs facade are documented');const json = doc.paths['/api/v1/tools/jsonminify/run'].post.requestBody.content['application/json'];assert.deepStrictEqual(json.schema.properties.input.required, ['text'], 'the tool input schema is inline');++// SEO-3: /openapi.json, where agents look first, redirects to this document.++const src = require('fs').readFileSync(require('path').join(__dirname, '..', 'server', 'index.js'), 'utf8');++assert.match(src, /app\.get\('\/openapi\.json', \(req, res\) => res\.redirect\(308, '\/api\/v1\/openapi\.json'\)\);/);console.log(`openapi: ${withApi.length} run paths, all checks passed`);
@@ -34,6 +34,8 @@ const { createGuard, TRUST_PROXY } = require('../../_shared/guard');
@@ -34,6 +34,8 @@ const { createGuard, TRUST_PROXY } = require('../../_shared/guard');
const { createNetworkSender } = require('openvibe-sdk/account-data'); // ADR-033: Tools' part of an export, back to Network
const { createNetworkSender } = require('openvibe-sdk/account-data'); // ADR-033: Tools' part of an export, back to Network
const app = express();
const app = express();
+// SEO-3: /openapi.json, where agents look first, is the gateway's own document (server/openapi.js).
+app.get('/openapi.json', (req, res) => res.redirect(308, '/api/v1/openapi.json'));
// Network's sign-out-everywhere cutoffs for every Tools app (./revocation-events.js): before any body parser.
// Network's sign-out-everywhere cutoffs for every Tools app (./revocation-events.js): before any body parser.
app.post('/internal/events', ...require('./revocation-events').handler());
app.post('/internal/events', ...require('./revocation-events').handler());
// What this deploy runs (ADR-016); the shared navbar's release-watch polls it on every tool host.
// What this deploy runs (ADR-016); the shared navbar's release-watch polls it on every tool host.
@@ -20,4 +20,7 @@ assert.strictEqual(ids.length, new Set(ids).size, 'operation ids are unique');
@@ -20,4 +20,7 @@ assert.strictEqual(ids.length, new Set(ids).size, 'operation ids are unique');
assert.ok(doc.paths['/api/v1/tools'] && doc.paths['/api/v1/jobs/{id}/events'], 'registry and jobs facade are documented');
assert.ok(doc.paths['/api/v1/tools'] && doc.paths['/api/v1/jobs/{id}/events'], 'registry and jobs facade are documented');
const json = doc.paths['/api/v1/tools/jsonminify/run'].post.requestBody.content['application/json'];
const json = doc.paths['/api/v1/tools/jsonminify/run'].post.requestBody.content['application/json'];
assert.deepStrictEqual(json.schema.properties.input.required, ['text'], 'the tool input schema is inline');
assert.deepStrictEqual(json.schema.properties.input.required, ['text'], 'the tool input schema is inline');
+// SEO-3: /openapi.json, where agents look first, redirects to this document.
+const src = require('fs').readFileSync(require('path').join(__dirname, '..', 'server', 'index.js'), 'utf8');
+assert.match(src, /app\.get\('\/openapi\.json', \(req, res\) => res\.redirect\(308, '\/api\/v1\/openapi\.json'\)\);/);
console.log(`openapi: ${withApi.length} run paths, all checks passed`);
console.log(`openapi: ${withApi.length} run paths, all checks passed`);