Skip to content

examples in scalar ui did not show currectly #1475

@vaytea

Description

@vaytea

I'm using Rocket,
here is my Route

#[utoipa::path(
    request_body = User,
    responses(
        (
            status = 201,
            description = "User created successfully",
            body = APIResponse,
            example = json!({ "message": Message::Successful, "result": null })
        ),
        (
            status = 401,
            description = "Insufficient access level",
            body = APIResponse,
            example =  json!({ "message": Message::InsufficientAccessLevel, "result": Value::Null }),
        ),
        (
            status = 401,
            description = "Insufficient permission",
            body = APIResponse,
            example = json!({ "message": Message::InsufficientPermission, "result": null })
        ),
        (
            status = 400,
            description = "Invalid data",
            body = APIResponse,
            example = json!({ "message": Message::InvalidData, "result": "username and password is required for user creation" })
        )
    ),
    security(
        ("api_key" = [])
    )
)]
#[post("/", data = "<user>")]
async fn create(
    _access: UserPageAccess,
    last_login: &State<Mutex<Option<LastLogin>>>,
    admin: &User,
    db: Db,
    mut user: Validated<Json<User>>,
) -> APIResponse {
...
}

the scalar gives me

Image

the swagger gives me

Image

also Swagger UI does not provide the two different 401 responses

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions