Skip to content

[BUG] UUID path param defined as integer in OpenAPI output #55

@Tuntii

Description

@Tuntii

RustAPI Version

Nan

Rust Version

Nan

Operating System

Windows

Description

The path parameter in the route /pins{id} is a UUID (Path<Uuid>), but in the generated openapi.json, the parameter is incorrectly defined as { "format": "int64", "type": "integer" } instead of the correct UUID type. See discussion: #53.

Steps to Reproduce

  1. Create a handler using Path<Uuid>:
/// Get a pin by ID
#[rustapi_rs::get("/pins{id}")]
#[rustapi_rs::tag("Pins")]
#[rustapi_rs::summary("Get Pin")]
#[rustapi_rs::description("Read a pin by id.")]
async fn read(
    State(state): State<AppState>,
    Path(id): Path<Uuid>,
) -> Result<Json<Pin>> {
    let pin = Pin::default();

    Ok(Json(pin))
}
  1. Check the generated /docs/openapi.json for the definition of the route parameter.
  2. Observe that id is defined as an integer, not a UUID.

Expected Behavior

The parameter id should be defined as a UUID type in the OpenAPI spec (e.g., { "type": "string", "format": "uuid" }).

Actual Behavior

id is defined as { "format": "int64", "type": "integer" } in the OpenAPI spec, which causes clients to treat it as a number, leading to integration errors.

Additional Context

See full details and screenshot in the linked discussion: #53

OpenAPI parameter UUID wrongly inferred as integer

Checklist

  • I have searched for similar issues and couldn't find any.
  • I have tried the latest version of RustAPI.
  • I have provided all the required information above.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions