Skip to content

[REQ] [rust-salvo] New server generator targeting the Salvo web framework #23771

@AuroraMaster

Description

@AuroraMaster

Is your feature request related to a problem? Please describe.

OpenAPI Generator currently has three Rust server options: rust-axum, rust-server (hyper-based), and the deprecated rust-server-deprecated. There is no generator for Salvo, a maturing Rust web framework with a first-class salvo::oapi layer for OpenAPI-driven APIs that an OpenAPI Generator output can target cleanly.

Describe the solution you'd like

Add a rust-salvo server generator that mirrors the rust-axum baseline (security, schema composition, parameter/wire format coverage) and produces code idiomatic to Salvo >= 0.76:

  • Handlers use #[salvo::oapi::endpoint] and the typed extractors in salvo::oapi::extract (JsonBody<T>, PathParam<T>, QueryParam<T, REQUIRED>, HeaderParam<T, REQUIRED>, FormBody<T>).
  • Models derive salvo::oapi::ToSchema so they flow through those extractors and surface in the generated OpenAPI doc.
  • Routes use the {name} path syntax (Salvo 0.76+).
  • Optional enableAuthMiddleware / enableCorsMiddleware / enableRequestValidation toggles, with auth middleware (ApiKeyAuth / BasicAuth / BearerAuth) emitted from the spec's securitySchemes.
  • Pinned to current stable Salvo 0.93 and validator 0.20.

Describe alternatives you've considered

Maintaining a downstream-only generator, but that fragments the ecosystem. rust-axum covers axum but cannot be retargeted to Salvo's macro-driven OpenAPI integration.

Additional context

Implementation is ready and validated:

  • Java tests: 7/7 pass (RustSalvoServerCodegenTest).
  • Generated petstore + the three rust-salvo test specs compile with cargo check cleanly against Salvo 0.93 (0 errors, 0 warnings).
  • Generator doc auto-exported to docs/generators/rust-salvo.md; declared feature set matches rust-axum (allOf / anyOf / oneOf, JSON wire, ApiKey + Basic + Bearer).
  • Pull request to follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions