Skip to content

Commit

Permalink
More work on "Paths"
Browse files Browse the repository at this point in the history
  • Loading branch information
RazMag committed Nov 6, 2023
1 parent 71b5891 commit 8b98d81
Showing 1 changed file with 54 additions and 6 deletions.
60 changes: 54 additions & 6 deletions cherrybomb-oas/src/new_oas/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub struct Paths {

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct PathItem {
pub item_ref: Option<RelReference>,
pub summary: Option<String>,
pub description: Option<String>,
pub get: Option<Operation>,
Expand All @@ -24,16 +23,65 @@ pub struct PathItem {
pub patch: Option<Operation>,
pub trace: Option<Operation>,
pub servers: Option<Vec<crate::new_oas::server::Server>>,
pub parameters: Option<Vec<ParamRef>>,
}

enum ParamRef {
Ref(RelReference),
Param(Parameter),
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct Operation {
pub tags: Option<Vec<String>>,
pub summary: Option<String>,
pub description: Option<String>,
#[serde(rename = "externalDocs")]
pub external_docs: Option<ExternalDocs>,
#[serde(rename = "operationId")]
pub operation_id: Option<String>,
pub parameters: Option<Vec<RelRef>>,
#[serde(rename = "requestBody")]
pub request_body: Option<RelRef>,
pub responses: Option<Responses>,
pub callbacks: Option<HashMap<String, RelRef>>,
pub deprecated: Option<bool>,
pub security: Option<Vec<Security>>,
pub servers: Option<Vec<crate::new_oas::server::Server>>,
}

pub struct Operation {
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct ExternalDocs {
pub description: Option<String>,
pub url: String,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct Parameter{
pub name: String,
#[serde(rename = "in")]
pub in_: String,
pub description: Option<String>,
pub required: Option<bool>,
pub deprecated: Option<bool>,
#[serde(rename = "allowEmptyValue")]
pub allow_empty_value: Option<bool>,
pub style: Option<String>,
pub explode: Option<bool>,
#[serde(rename = "allowReserved")]
pub allow_reserved: Option<bool>,
pub schema: Option<Schema>,
pub example: Option<Value>,
pub examples: Option<HashMap<String, RelRef>>,
pub content: Option<HashMap<String, MediaType>>,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct Responses {
#[serde(rename = "default")]
pub default: Option<RelRef>,
pub responses: Option<HashMap<String, RelRef>>,
pub extensions: Option<HashMap<String, Value>>,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct Response {
pub description: String,
pub headers: Option<HashMap<String, RelRef>>,
pub content: Option<HashMap<String, MediaType>>,
pub links: Option<HashMap<String, RelRef>>,
}

0 comments on commit 8b98d81

Please sign in to comment.