Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: preserve generated API contracts during local development (#41834)

Stephen Zhouad90cb911138
diff --git a/packages/contracts/openapi-ts.api.config.ts b/packages/contracts/openapi-ts.api.config.ts
index 1feab712fcb..a2b272336cb 100644
--- a/packages/contracts/openapi-ts.api.config.ts
+++ b/packages/contracts/openapi-ts.api.config.ts
@@ -40,7 +40,6 @@ type ApiSpec = {
}
type ApiJob = {
- clean?: boolean
document: SwaggerDocument
outputPath: string
plugins?: UserConfig['plugins']
@@ -527,7 +526,6 @@ const writeConsoleRouterContract = (segments: string[]) => {
const createConsoleContractEntryJob = (document: SwaggerDocument, segments: string[]): ApiJob => {
return {
- clean: false,
document,
outputPath: 'generated/api/console',
plugins: [],
@@ -587,7 +585,7 @@ const createApiConfig = (job: ApiJob): UserConfig => ({
file: false,
},
output: {
- ...(job.clean === undefined ? {} : { clean: job.clean }),
+ clean: false,
entryFile: false,
fileName: {
suffix: '.gen',
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index c8e5916c6a6..b9aae0184db 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -30,7 +30,7 @@
}
},
"scripts": {
- "gen-api-contract": "uv run --project ../../api ../../api/dev/generate_swagger_specs.py --output-dir openapi && uv run --project ../../api ../../api/dev/generate_fastopenapi_specs.py --output-dir openapi && node -e \"fs.rmSync('generated/api', { recursive: true, force: true })\" && openapi-ts -f openapi-ts.api.config.ts && vp fmt generated/api",
+ "gen-api-contract": "uv run --project ../../api ../../api/dev/generate_swagger_specs.py --output-dir openapi && uv run --project ../../api ../../api/dev/generate_fastopenapi_specs.py --output-dir openapi && node -e \"if (process.env.CI) fs.rmSync('generated/api', { recursive: true, force: true })\" && openapi-ts -f openapi-ts.api.config.ts && vp fmt generated/api",
"gen-enterprise-contract": "openapi-ts -f openapi-ts.enterprise.config.ts",
"gen-enterprise-app-deploy-contract": "openapi-ts -f openapi-ts.enterprise-app-deploy.config.ts",
"gen-knowledge-fs-contract": "node scripts/generate-knowledge-fs-contract.mjs",