feat: expose drop deployment endpoint in public API#3923
Open
fdarian wants to merge 4 commits intoDokploy:canaryfrom
Open
feat: expose drop deployment endpoint in public API#3923fdarian wants to merge 4 commits intoDokploy:canaryfrom
fdarian wants to merge 4 commits intoDokploy:canaryfrom
Conversation
Enable file upload deployments via the public API, unlocking CI/CD workflows similar to `railway up`. Users can now programmatically deploy by uploading zip archives. Depends on: Dokploy/trpc-openapi multipart/form-data support
Switch from z.instanceof(FormData) to uploadFileSchema (zod-form-data) so the OpenAPI generator produces a proper multipart/form-data spec with typed fields (zip as binary, applicationId, dropBuildPath). Regenerate openapi.json with the drop-deployment endpoint included.
|
Related Documentation 1 document(s) may need updating based on files changed in this PR: Dokploy's Space README
|
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve #3922
Summary
Expose the
dropDeploymentendpoint in the public API, enabling programmatic file-upload deployments viamultipart/form-data.The endpoint already existed for the web UI — this PR makes it available through the REST API with proper OpenAPI documentation.
Changes
enabled: falsefromdropDeploymentOpenAPI meta to expose the endpointz.instanceof(FormData)touploadFileSchema(zod-form-data) so the OpenAPI generator can produce a propermultipart/form-dataspec with typed fields@dokploy/trpc-openapito a version that supports multipart/form-data (file field detection, binary format in OpenAPI output)openapi.jsonwith the new endpoint includedAPI
zipapplicationIddropBuildPathExample usage
Test plan
pnpm generate:openapisucceeds andopenapi.jsoncontains/drop-deploymentwithmultipart/form-datacontent typeGreptile Summary
This PR exposes the existing
dropDeploymenttRPC endpoint through the public REST API (POST /api/drop-deployment) by removingenabled: falsefrom its OpenAPI metadata and swapping the input schema fromz.instanceof(FormData)touploadFileSchema(zod-form-data), which enables proper OpenAPI spec generation formultipart/form-datauploads.Key issue found:
applicationIdis optional in schema but required at runtime. The OpenAPI spec correctly marksapplicationIdas optional (only"zip"is required), but the endpoint code omits validation. When a caller omitsapplicationIdper the spec,findApplicationById(undefined)is called, the query fails silently, and accessingapp.environment.project.organizationIdon the undefined result throws a TypeError. This produces a 500 error instead of a helpful 400 validation error. The field should either be required in the schema or guarded with an explicit early-return check.Confidence Score: 2/5
applicationIdfield.applicationIdis omitted,findApplicationById(undefined)returns no match, and the subsequent property access throws a TypeError. This results in opaque 500 errors for API consumers following the (correct) OpenAPI spec. The endpoint should validateapplicationIdbefore database operations. The core functionality is sound, but this validation defect significantly impacts the reliability of the newly exposed public API.apps/dokploy/server/api/routers/application.ts— theapplicationIdvalidation needs to be added either at the schema level or via an explicit guard check in the mutation handler.Last reviewed commit: 66931fe
(2/5) Greptile learns from your feedback when you react with thumbs up/down!
Context used: