GREsau / GREsau/okapi

Parameter examples generate incorrect OpenAPI schema

Open
#112 2 comments 0 reactions 0 assignees View on GitHub
okapi
Dominant language
Rust
Stars
740
Forks
127
PR merge metrics
No merged PRs in 30d

Description

```rust
#[derive(Serialize, FromForm, JsonSchema)]
#[schemars(example = "example_param")]
struct Param(i32);

fn example_param() -> Param {
Param(10)
}

#[openapi]
#[get("/example?")]
fn get_param(param: Param) {}
```
Returns a spec containing
```json
"examples": [
10
]
```
instead of
```json
"example": 10
```

Using rocket-okapi 0.8.0-rc.2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.