Skip to content

refactor(openapi)!: use static operation constructors - #113

Merged
Kilerd merged 1 commit into
mainfrom
refactor/static-operables
Sep 14, 2026
Merged

Kilerd merged 1 commit into
mainfrom
refactor/static-operables

Conversation

@Kilerd

@Kilerd Kilerd commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

#[api] generated lazy vectors of boxed parameter constructors and a lazy boxed response constructor even though none captured runtime state. Operable now stores a static slice of parameter function pointers and a response function pointer directly in its inventory entry.

Remove UUID-named helper statics and the macro crate's UUID dependency. Move generated parameters and request bodies into the operation instead of cloning owned values. Constructors still execute for each operation inside the document's schema collection scope; response inference, explicit declarations, and captured user transforms retain their existing behavior.

This changes the public ParamConstructor alias and Operable constructor fields. MIGRATION includes their replacements and guidance for capturing closures, and the Operable docs include a compilable static initializer. Ordinary #[api] usage is unchanged. This is a structural simplification with no benchmarked performance claim.

Validation:

  • Compared the complete serialized OpenAPI output of the same fixture before and after the change: byte-for-byte identical. The fixture combines path/query parameters, a skipped argument without ParameterProvider, generic request/response DTOs, recursive schemas, and explicit error/response overrides.
  • Added one regression test comparing macro-generated and manually constructed static descriptors, including reuse at different paths and independent schema collection scopes.
  • Local checks: workspace all-feature compilation, gotcha default/all-feature tests, macro all-feature/no-default-feature tests, workspace Clippy, formatting, and diff checks.

All 11 GitHub CI checks passed for 38fb6af5671872eb47832660fc517262967429f3.

Closes #95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P3][macro] 精简 Operable 生成中的 Lazy、Vec 和动态闭包封装

1 participant