Skip to content

feat(web): export OpenAPI mapper types and compatible contract subpaths - #44915

Merged
hyoban merged 16 commits into
mainfrom
feat/openapi-content-mapper-type-exports
Oct 28, 2026
Merged

hyoban merged 16 commits into
mainfrom
feat/openapi-content-mapper-type-exports

Conversation

@hyoban

@hyoban hyoban commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

OpenAPI mapper consumers can infer calls, but migration also needs reusable schema types and the named request/response types already exposed by contracts. Export Schemas, Inputs, and Outputs from mapped documents, and add opt-in, type-only workspace subpaths such as @dify/openapi-content-mapper/console/datasets that preserve existing contract type names and structures.

Fixes #44626. Follow-up to #44627.

  • Share document normalization, Console grouping, and TypeScript generation settings with contracts. Export Community types from current Python schemas in memory; Enterprise uses retained snapshots and existing exports for models absent from those snapshots.
  • Add .openapi-types sources with inherited configuration, glob registration, and dependency invalidation. Thin module descriptors share two exporter configurations and refresh after the existing contract generation commands.
  • Keep existing @dify/contracts exports and production consumers unchanged. Runtime enums remain in contracts. Dify-specific subpaths require repository development dependencies and are excluded from the standalone npm package.
  • Add documentation, Petstore examples, and examples using real Dify API types. No additional generated declarations or OpenAPI snapshots are checked in.

Validation

  • pnpm --filter @dify/contracts type-check
  • pnpm --filter @dify/contracts test — 52 tests passed.
  • pnpm --filter @dify/openapi-content-mapper build
  • pnpm --filter @dify/openapi-content-mapper type-check
  • pnpm --filter @dify/openapi-content-mapper type-check:contracts
  • pnpm --filter @dify/openapi-content-mapper test — 56 tests passed.
  • pnpm --filter @dify/openapi-content-mapper test:contracts — 2 tests passed; bidirectional compatibility checked across 60 modules, 10,569 named types, and 44 enum objects.
  • pnpm --filter @dify/openapi-content-mapper test:package — packed SDK installation and public exports verified.
  • pnpm exec vp staged and git diff --check passed.
  • Verified the repository example's inferred type hover in VS Code with TypeScript 7.1.

Screenshots

Not applicable: type exports and development tooling.

Checklist

  • This change requires a Dify Document update (not applicable; package README and examples updated).
  • I understand that this PR may be closed in case there was no previous discussion or issues.
  • I've verified the change and added or updated tests where meaningful regression risk justifies coverage.
  • I've updated the documentation accordingly.
  • I ran vp staged for the frontend tooling changes. Backend lint and type-check commands are not applicable; no Python files changed.

@github-actions github-actions Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. web This relates to changes on the web. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Oct 28, 2026
@github-actions github-actions Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Oct 28, 2026
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.44068% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.53%. Comparing base (52b15b8) to head (50965eb).

Files with missing lines Patch % Lines
api/dev/export_console_openapi.py 82.60% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #44915      +/-   ##
==========================================
- Coverage   89.53%   89.53%   -0.01%     
==========================================
  Files        6008     6008              
  Lines      376874   376906      +32     
  Branches    76259    76267       +8     
==========================================
+ Hits       337438   337461      +23     
- Misses      33439    33449      +10     
+ Partials     5997     5996       -1     
Flag Coverage Δ
api 89.39% <86.44%> (-0.01%) ⬇️
cli 94.28% <ø> (ø)
dify-ui 92.65% <ø> (ø)
web 89.49% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 79.91% 79.91% +0.00%
Strict coverage 79.60% 79.60% +0.00%
Typed symbols 76,695 76,709 +14
Untyped symbols 19,359 19,359 0
Modules 3981 3982 +1

@hyoban
hyoban marked this pull request as ready for review October 28, 2026 08:55
lyzno1
lyzno1 previously approved these changes Oct 28, 2026
@hyoban
hyoban added this pull request to the merge queue Oct 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 28, 2026
@hyoban
hyoban added this pull request to the merge queue Oct 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 28, 2026
@hyoban
hyoban added this pull request to the merge queue Oct 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 28, 2026
@hyoban
hyoban added this pull request to the merge queue Oct 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Oct 28, 2026
…mapper-type-exports

# Conflicts:
#	packages/openapi-content-mapper/test/source.test.mjs
@hyoban
hyoban added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 04ba877 Oct 28, 2026
63 of 64 checks passed
@hyoban
hyoban deleted the feat/openapi-content-mapper-type-exports branch October 28, 2026 14:47
@laipz8200 laipz8200 mentioned this pull request Nov 3, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore a TypeScript 7.1 inferred OpenAPI SDK with tree-shakable console calls

2 participants