Skip to content

fix(api): make the OpenAPI document generate again - #37

Merged
agentHits merged 3 commits into
AgentHits-Devfrom
claude/swagger-openapi-version-8646fe
Oct 7, 2026
Merged

agentHits merged 3 commits into
AgentHits-Devfrom
claude/swagger-openapi-version-8646fe

Conversation

@agentHits

Copy link
Copy Markdown
Collaborator

Problem

/swagger shows "The provided definition does not specify a valid version field". The page itself loads, but settings.getOpenApiDocument returns 500, so Swagger UI renders its empty initial spec {}.

generateOpenApiDocument throws for the whole router as soon as one procedure has an input it can't describe:

[query.dockerDiskUsage.getDiskUsage] - Input parser key: "detailLimit" must be ZodString, ZodNumber, ZodBoolean, ZodBigInt or ZodDate
[query.github.appSetupState] - Input parser must be a ZodObject

Both procedures were added in this fork, not upstream.

Fix

  • dockerDiskUsage.getDiskUsage and settings.getDockerDiskUsage now share dockerDiskUsageDetailLimitSchema. It is a coerced number piped into 5 | 10 | 15, still nullable/optional. The generator accepts it, the tRPC client keeps sending numbers, and REST callers can now pass ?detailLimit=5. Before this change, that string failed the literal check.
  • github.appSetupState takes a discriminated-union input the generator can't express. It only drives the in-panel GitHub App setup redirect, so it is excluded from OpenAPI with enabled: false, the same way readStatsLogs is.
  • New test __test__/api/openapi-document.test.ts generates the document for the full app router and checks the detail-limit parsing. Two tests that mock @dokploy/server now also mock the new schema.

Verification

  • The OpenAPI document generates locally: OpenAPI 3.1.0, 639 paths.
  • tsc --noEmit and biome pass.
  • The full vitest suite passes except deploy/application.real.test.ts (4 tests). Those tests run real Docker/nixpacks builds and are unrelated to this change.

After deploy, /swagger should list the API. Use Authorize with an API key to send requests.

🤖 Generated with Claude Code

agentHits and others added 3 commits October 7, 2026 08:18
/swagger rendered an empty spec ("does not specify a valid version
field") because settings.getOpenApiDocument returned 500: the generator
throws for the whole router as soon as one procedure has an input it
cannot describe.

- dockerDiskUsage.getDiskUsage and settings.getDockerDiskUsage took
  detailLimit as a union of numeric literals, which the generator rejects
  for query inputs. Both now share dockerDiskUsageDetailLimitSchema, a
  coerced number piped into 5 | 10 | 15, so the generator accepts it and
  REST callers can pass ?detailLimit=5.
- github.appSetupState takes a discriminated-union input the generator
  cannot express. It only drives the in-panel GitHub App setup redirect,
  so it is excluded from OpenAPI like readStatsLogs.
- A test generates the document for the full app router so a new
  procedure cannot silently break /swagger again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er-openapi-version-8646fe

# Conflicts:
#	apps/dokploy/__test__/settings/docker-server-boundary.test.ts
#	apps/dokploy/__test__/settings/request-log-authorization.test.ts
"Time left" is floored to whole minutes. When a millisecond passed
between building expiresAt and formatting the alert, the message read
"23 h 59 min" and the test failed in CI. Freezing only Date keeps fetch
and the rest of the timers real.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agentHits
agentHits merged commit 2dffe76 into AgentHits-Dev Oct 7, 2026
8 checks passed
@agentHits
agentHits deleted the claude/swagger-openapi-version-8646fe branch October 7, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant