Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/swagger-ui-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@crypt.fyi/server': patch
---

Upgrade `@fastify/swagger-ui` to v6, which depends on the patched `@fastify/static` 10 line directly.
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@fastify/helmet": "^13.0.1",
"@fastify/rate-limit": "^10.3.0",
"@fastify/swagger": "^9.5.1",
"@fastify/swagger-ui": "^5.2.3",
"@fastify/swagger-ui": "^6.1.1",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/auto-instrumentations-node": "^0.81.0",
"@opentelemetry/exporter-trace-otlp-proto": "^0.223.0",
Expand Down
25 changes: 25 additions & 0 deletions packages/server/src/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,31 @@ describe('app', () => {
expect(response.statusCode).toBe(200);
});

it('serves the swagger UI, its assets and the OpenAPI document', async () => {
const get = (path: string) => testContext.client.request({ method: 'GET', path });
const { swaggerUIPath } = testContext.config;

const page = await get(swaggerUIPath);
expect(page.statusCode).toBe(200);
const html = await page.body.text();
expect(html).toContain('swagger-ui');
// helmet's default CSP blocks inline scripts, so the page only works if all of them are external.
expect(html).not.toMatch(/<script(?![^>]*\bsrc=)[^>]*>/);

const bundle = await get(`${swaggerUIPath}/static/swagger-ui-bundle.js`);
expect(bundle.statusCode).toBe(200);
await bundle.body.dump();

const initializer = await get(`${swaggerUIPath}/static/swagger-initializer.js`);
expect(initializer.statusCode).toBe(200);
await initializer.body.dump();

const spec = await get(`${swaggerUIPath}/json`);
expect(spec.statusCode).toBe(200);
const { paths } = (await spec.body.json()) as { paths: Record<string, unknown> };
expect(paths).toHaveProperty('/vault');
});

it('retrieves and burns vault entry', async () => {
const createResponse = await testContext.client.request({
method: 'POST',
Expand Down
24 changes: 11 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ overrides:
'@opentelemetry/core': 2.12.0
'@opentelemetry/propagator-jaeger': 2.12.0
'@babel/core': 7.29.6
# swagger-ui still declares ^9.x; 10.1.2 is the first line with the path-bypass fixes
'@fastify/static': 10.1.2
adm-zip: 0.6.1
# node-notifier / web-ext-run still declare uuid@8; CJS named exports remain compatible
uuid: 11.1.1
Expand Down
Loading