OpenAPITools / OpenAPITools/openapi-generator
[BUG][rust-axum] Doc tests fail due to invalid should_panic attribute
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Doc tests of code generated with rust-axum generator fail since Rust 1.80.0 because of a bug in modules/openapi-generator/src/main/resources/rust-axum/types.mustache
openapi-generator version
7.8.0
Not a regression I think but the Rust toolchain has become more restrictive (it didn't fail with Rust 1.77.1)
OpenAPI declaration file content or url
Not applicable
Generation Details
$openapi_cli generate \
-i "${api_spec}" \
-o "${out_dir}" \
-g rust-axum \
--additional-properties=packageName="$package_name" \
--name-mappings type=type_property \
--openapi-normalizer FILTER="operationId:${route_filter}"
Steps to reproduce
Generate rust-axum, execute cargo test
Related issues/PRs
Didn't find anytghin
Suggest a fix
--- a/openapi-generator/templates/rust-axum/types.mustache
+++ b/openapi-generator/templates/rust-axum/types.mustache
@@ -175,7 +175,7 @@ impl<T> Nullable<T> {
/// assert_eq!(x.expect("the world is ending"), "value");
/// ```
///
- /// ```{.should_panic}
+ /// ```should_panic
/// # use {{{externCrateName}}}::types::Nullable;
///
/// let x: Nullable<&str> = Nullable::Null;
@@ -210,7 +210,7 @@ impl<T> Nullable<T> {
/// assert_eq!(x.unwrap(), "air");
/// ```
///
- /// ```{.should_panic}
+ /// ```should_panic
/// # use {{{externCrateName}}}::types::Nullable;
///
/// let x: Nullable<&str> = Nullable::Null;
I'll create a pull request
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in modules/openapi-generator/src/main/resources/rust-axum/types.mustache, focusing on the Nullable documentation examples identified in the report. Generate a rust-axum project with the shown command and run cargo test to reproduce the failure. Done means the generated doc tests pass on Rust 1.80 and later.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100