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

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

Closed
juhaku opened this issue May 15, 2024 · 0 comments · Fixed by #929
Closed

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

juhaku opened this issue May 15, 2024 · 0 comments · Fixed by #929
Labels
bug Something isn't working

Comments

@juhaku
Copy link
Owner

juhaku commented May 15, 2024

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

@juhaku juhaku added the bug Something isn't working label May 15, 2024
@juhaku juhaku moved this to In Progress in utoipa kanban May 15, 2024
juhaku added a commit that referenced this issue May 16, 2024
Fix compile error propagation via comprehensive use of
`ToTokensDiagnostics` trait. `ToTokensDiagnostics` was introduced in
PR #920 to allow error propagation up in the call stack for error
reporting. However this initial implementation was too limited which
resulted invalid compile errors in case of error. This implementation
aims to fix the shortcomings of the initial implementation.

Fixes #927
@github-project-automation github-project-automation bot moved this from In Progress to Done in utoipa kanban May 16, 2024
@juhaku juhaku moved this from Done to Released in utoipa kanban Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

1 participant