Skip to content

fix: add sourceType to apiCreateCompose and apiCreateApplication#4710

Open
elijahdev0 wants to merge 1 commit into
Dokploy:canaryfrom
elijahdev0:fix/add-source-type-to-create-apis
Open

fix: add sourceType to apiCreateCompose and apiCreateApplication#4710
elijahdev0 wants to merge 1 commit into
Dokploy:canaryfrom
elijahdev0:fix/add-source-type-to-create-apis

Conversation

@elijahdev0

Copy link
Copy Markdown
Contributor

Problem

apiCreateCompose and apiCreateApplication use createSchema.pick({...}) but omit sourceType from the pick list. Because the DB column defaults to "github":

sourceType: sourceTypeCompose("sourceType").notNull().default("github")

Every compose/application created via the API gets sourceType: "github" regardless of intention. Users must manually update it after creation via the compose/application update endpoint.

Fix

Add sourceType: true to both .pick() schemas:

  • packages/server/src/db/schema/compose.tsapiCreateCompose
  • packages/server/src/db/schema/application.tsapiCreateApplication

Why it's safe

sourceType is already defined as .optional() in both createSchemas, so callers that don't send it will still get the DB default ("github"). This is purely additive — no breaking change.

Template-based creation (createComposeByTemplate) and the /compose.update endpoint are unaffected (they already handle sourceType correctly).

Impact

  • POST /compose.create now accepts an optional sourceType field
  • POST /application.create now accepts an optional sourceType field
  • ✅ OpenAPI spec auto-fixes on regeneration (generated via trpc-openapi from Zod schemas)
  • ✅ Backward compatible — existing callers continue to work unchanged

apiCreateCompose and apiCreateApplication did not include sourceType in their .pick() schemas, causing every compose/application created via the API to default to 'github' in the DB. Users had to manually update the sourceType after creation.

sourceType is already defined as .optional() in both createSchemas, so this is backward-compatible — callers that don't send it will still get the DB default ('github').
@elijahdev0 elijahdev0 requested a review from Siumauricio as a code owner June 30, 2026 03:38
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant