Skip to content

Conversation

@yuki0418
Copy link

close #1213

I haven't check it return Enum values.

When I debug with

utoipa = { git = "ssh://github.com/yuki0418/utoipa.git", branch = "feat/support-chrono-weekday", features = [
    "uuid",
    "axum_extras",
    "debug",
    "chrono",
    "config",
] }
utoipa-swagger-ui = { version = "9.0.0", features = [
    "axum",
    "vendored",
], default-features = false }
utoipa-axum = { version = "0.2.0", features = ["debug"] }

I get error

error: could not compile `utoipa-axum` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
[Running 'cargo check']==============> ] 610/613: utoipa                                
    Blocking waiting for file lock on build directory
    Checking utoipa-axum v0.2.0
error[E0277]: `utoipa::openapi::OpenApi` doesn't implement `Debug`
   --> /Users/yuki/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/utoipa-axum-0.2.0/src/router.rs:129:45
    |
128 | #[cfg_attr(feature = "debug", derive(Debug))]
    |                                      ----- in this derive macro expansion
129 | pub struct OpenApiRouter<S = ()>(Router<S>, utoipa::openapi::OpenApi);
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^ `utoipa::openapi::OpenApi` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
    = help: the trait `Debug` is not implemented for `utoipa::openapi::OpenApi`

If I remove debug, I get this error

.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", doc))
    |                                              ---                           ^^^ expected `utoipa::openapi::OpenApi`, found a different `utoipa::openapi::OpenApi`
    |                                              |
    |                                              arguments to this method are incorrect

Do you have any other ideas to how to debug?

@yuki0418 yuki0418 force-pushed the feat/support-chrono-weekday branch from 5abe859 to 6964dfe Compare June 28, 2025 00:08
@yuki0418
Copy link
Author

I figure out with patch.crates-io.
And this change returns String type for WeekDay Enum.

I will check how to implement Enum type.

@yuki0418
Copy link
Author

@juhaku

chrono::Weekday is Enum and, sorry I have read code but couldn't get it how to support the external Enum type.

Could you give me some example for this case??

Weekday enum is

#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
#[cfg_attr(
    any(feature = "rkyv", feature = "rkyv-16", feature = "rkyv-32", feature = "rkyv-64"),
    derive(Archive, Deserialize, Serialize),
    archive(compare(PartialEq)),
    archive_attr(derive(Clone, Copy, PartialEq, Eq, Debug, Hash))
)]
#[cfg_attr(feature = "rkyv-validation", archive(check_bytes))]
#[cfg_attr(all(feature = "arbitrary", feature = "std"), derive(arbitrary::Arbitrary))]
pub enum Weekday {
    /// Monday.
    Mon = 0,
    /// Tuesday.
    Tue = 1,
    /// Wednesday.
    Wed = 2,
    /// Thursday.
    Thu = 3,
    /// Friday.
    Fri = 4,
    /// Saturday.
    Sat = 5,
    /// Sunday.
    Sun = 6,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant