Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][rust-axum] Doc tests fail due to invalid should_panic attribute #19538

Open
2 of 6 tasks
faro-dr opened this issue Sep 6, 2024 · 1 comment
Open
2 of 6 tasks

Comments

@faro-dr
Copy link

faro-dr commented Sep 6, 2024

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

faro-dr added a commit to faro-dr/openapi-generator that referenced this issue Sep 6, 2024
@faro-dr
Copy link
Author

faro-dr commented Sep 6, 2024

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

No branches or pull requests

1 participant