juhaku / utoipa

Simple, Fast, Code first and Compile time generated OpenAPI documentation for Rust
Apache License 2.0
2.23k stars 173 forks source link

Fix compile error for path params, proc macro error migration after effect #927

Closed juhaku closed 4 months ago

juhaku commented 4 months ago

After migrating off from proc_macro_error crate the path tuple params compile error does not get propagated correctly up

fn path_item(default_tag:Option< &str>) -> utoipa::openapi::path::PathItem {
        use utoipa::openapi::ToArray;
        use std::iter::FromIterator;
        utoipa::openapi::PathItem::new(utoipa::openapi::PathItemType::Get,utoipa::openapi::path::OperationBuilder::new().responses(utoipa::openapi::ResponsesBuilder::new().response("200",utoipa::openapi::ResponseBuilder::new().description("success response").build()).build()).operation_id(Some("get_foo")
        ).parameters(Some(<Query as utoipa::IntoParams> ::into_params(||None))).parameter(::core::compile_error!("Missing `parameter_type` attribute, cannot define schema features without it.\n\nhelp = See docs for more details <https://docs.rs/utoipa/latest/utoipa/attr.path.html#parameter-type-attributes>");
        ).tag(*[Some(""),default_tag,Some("crate")].iter().flatten().find(|t| !t.is_empty()).unwrap()))
    }

Related to #920