Skip to content

Commit

Permalink
oapi: Give extractors REQUIRED default value (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn authored Sep 8, 2024
1 parent 9c6f867 commit 7953eca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/oapi/src/extract/parameter/cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::endpoint::EndpointArgRegister;
use crate::{Components, Operation, Parameter, ParameterIn, ToSchema};

/// Represents the parameters passed by Cookie.
pub struct CookieParam<T, const REQUIRED: bool>(Option<T>);
pub struct CookieParam<T, const REQUIRED: bool = true>(Option<T>);
impl<T> CookieParam<T, true> {
/// Consumes self and returns the value of the parameter.
pub fn into_inner(self) -> T {
Expand Down
2 changes: 1 addition & 1 deletion crates/oapi/src/extract/parameter/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::endpoint::EndpointArgRegister;
use crate::{Components, Operation, Parameter, ParameterIn, ToSchema};

/// Represents the parameters passed by header.
pub struct HeaderParam<T, const REQUIRED: bool>(Option<T>);
pub struct HeaderParam<T, const REQUIRED: bool = true>(Option<T>);
impl<T> HeaderParam<T, true> {
/// Consumes self and returns the value of the parameter.
pub fn into_inner(self) -> T {
Expand Down
2 changes: 1 addition & 1 deletion crates/oapi/src/extract/parameter/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::endpoint::EndpointArgRegister;
use crate::{Components, Operation, Parameter, ParameterIn, ToSchema};

/// Represents the parameters passed by the URI path.
pub struct QueryParam<T, const REQUIRED: bool>(Option<T>);
pub struct QueryParam<T, const REQUIRED: bool = true>(Option<T>);
impl<T> QueryParam<T, true> {
/// Consumes self and returns the value of the parameter.
pub fn into_inner(self) -> T {
Expand Down

0 comments on commit 7953eca

Please sign in to comment.