API: mutations require explicitly passing unrelated nullable fields (saveBuildType, saveEnvironment, registry.create)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 37.4k
- Forks
- 3k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 73
Description
Summary
When driving Dokploy through the HTTP/tRPC API (automation, provisioning), several mutations reject otherwise-complete payloads unless the caller explicitly passes fields that are unrelated to their use case and nullable in the DB. The web UI never hits this because it always submits every form field, but API consumers discover each required field by trial and error against BAD_REQUEST responses.
Cases we hit while integrating (Dokploy v0.29.x, still present in canary):
application.saveBuildType—apiSaveBuildTypeis built with.pick({...}).required()(packages/server/src/db/schema/application.ts), so settingbuildType: "dockerfile"still requires explicitly sendingherokuVersion: nullandrailpackVersion: null, fields that only apply to other build types.application.saveEnvironment—apiSaveEnvironmentVariablesrequiresbuildArgs,buildSecretsandcreateEnvFileeven when the caller only wants to setenv.registry.create—registryType: z.enum(["cloud"])is a required single-value enum (packages/server/src/db/schema/registry.ts), so every caller must passregistryType: "cloud"even though no other value is accepted and the column already defaults to"cloud".
Proposal
Make these fields optional in the API schemas with the defaults the UI uses today:
herokuVersion/railpackVersion→ optional, defaultnull.buildArgs/buildSecrets→ optional, defaultnull;createEnvFile→ optional, defaultfalse.registryType→ optional, default"cloud"(matching the column default), or drop it from the input schema entirely while it has a single accepted value.
This is backward compatible: payloads that pass today keep passing, and the generated OpenAPI surface stops requiring no-op fields.
Happy to send a PR (with tests) if you agree with the direction — flagging it first since it touches API validation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apiSaveBuildType and apiSaveEnvironmentVariables in the application schema at packages/server/src/db/schema/application.ts, then inspect the registry input schema in packages/server/src/db/schema/registry.ts. Add coverage for payloads that omit unrelated fields and verify the generated API validation accepts them with the stated defaults while existing payloads still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100