-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add derive responses for openapi schema * Add tests for path responses
- Loading branch information
Showing
18 changed files
with
796 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::Component; | ||
|
||
#[derive(Serialize, Deserialize, Default)] | ||
#[non_exhaustive] | ||
pub struct Content { | ||
pub schema: Component, | ||
} | ||
|
||
impl Content { | ||
pub fn new<I: Into<Component>>(schema: I) -> Self { | ||
Self { | ||
schema: schema.into(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::{Component, ComponentType, Property}; | ||
|
||
#[non_exhaustive] | ||
#[derive(Serialize, Deserialize)] | ||
pub struct Header { | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub description: Option<String>, | ||
|
||
pub schema: Component, | ||
} | ||
|
||
impl Header { | ||
pub fn new<C: Into<Component>>(component: C) -> Self { | ||
Self { | ||
schema: component.into(), | ||
..Default::default() | ||
} | ||
} | ||
|
||
pub fn with_description<S: AsRef<str>>(mut self, description: S) -> Self { | ||
self.description = Some(description.as_ref().to_string()); | ||
|
||
self | ||
} | ||
} | ||
|
||
impl Default for Header { | ||
fn default() -> Self { | ||
Self { | ||
description: Default::default(), | ||
schema: Property::new(ComponentType::String).into(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.