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

Add support for serde skip in IntoParams derive #743

Merged
merged 1 commit into from
Aug 20, 2023

Conversation

juhaku
Copy link
Owner

@juhaku juhaku commented Aug 20, 2023

Add support for serde's skip attribute in IntoParams derive macro. This allows users to use the serde's skip, skip_serializing or skip_deserializing attribute to ignore the field being added as a parameter to a OpenAPI documentation.

 #[derive(IntoParams, Serialize)]
 #[into_params(parameter_in = Query)]
 #[allow(unused)]
 struct Params {
     name: String,
     name2: Option<String>,
     #[serde(skip)]
     name3: Option<String>,
 }

Resolves #732

Add support for serde's `skip` attribute in `IntoParams` derive macro.
This allows users to use the serde's `skip`, `skip_serializing` or
`skip_deserializing` attribute to ignore the field being added as a
parameter to a OpenAPI documentation.
```rust
 #[derive(IntoParams, Serialize)]
 #[into_params(parameter_in = Query)]
 #[allow(unused)]
 struct Params {
     name: String,
     name2: Option<String>,
     #[serde(skip)]
     name3: Option<String>,
 }
```
@juhaku juhaku merged commit 5fb25fa into master Aug 20, 2023
10 checks passed
@juhaku juhaku deleted the feature-into-parmas-serde-skip branch August 20, 2023 14:10
@VirusBLITZ
Copy link

any option to keep a field, for example when I'm only using #[serde(skip_deserializing)] but still want the field to show up? (I'm never deserializing it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

#[serde(skip)] support for #[derive(IntoParams]
2 participants