DioxusLabs/dioxus · error · syn::Error

Use `api_route` instead of `route` to use OpenAPI options

Error message

Use `api_route` instead of `route` to use OpenAPI options

What it means

Check in ApiOptions::from_route: OpenAPI (aide) options were supplied on a route generated via #[route]/method macros instead of #[api_route]. The faulting input is the oapi_options present on the Route while with_aide is false; move the endpoint to api_route to attach OpenAPI options.

Solutions

  1. Use `api_route` instead of `route` when you want to attach OpenAPI options to the endpoint.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/fullstack-macro/src/lib.rs:637 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/cf9c8ccfa9d65988. Report an issue: GitHub.

Appendix: source

Thrown at packages/fullstack-macro/src/lib.rs:637

                    path.push_str(&lit.value());
                    path.push('}');
                }
                PathParam::Static(lit) => path.push_str(&lit.value()),
            }
        }

        Some(path)
    }

    /// Removes the arguments in `route` from `args`, and merges them in the output.
    pub fn from_route(
        mut route: Route,
        function: &ItemFn,
        with_aide: bool,
        method_from_macro: Option<Method>,
    ) -> syn::Result<Self> {
        if !with_aide && route.oapi_options.is_some() {
            return Err(syn::Error::new(
                Span::call_site(),
                "Use `api_route` instead of `route` to use OpenAPI options",
            ));
        } else if with_aide && route.oapi_options.is_none() {
            route.oapi_options = Some(OapiOptions {
                summary: None,
                description: None,
                id: None,
                hidden: None,
                tags: None,
                security: None,
                responses: None,
                transform: None,
            });
        }

        let sig = &function.sig;
        let mut arg_map = sig

View on GitHub (pinned to 24f6a829df)