-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented almost all the objects from the openapi spec
- Loading branch information
Showing
16 changed files
with
170 additions
and
67 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 std::collections::HashMap; | ||
|
||
// https://spec.openapis.org/oas/v3.1.0#components-object | ||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)] | ||
pub struct Components { | ||
pub schemas: Option<HashMap<String, Schema>>, | ||
pub responses: Option<HashMap<String, RelRef>>, | ||
pub parameters: Option<HashMap<String, RelRef>>, | ||
pub examples: Option<HashMap<String, RelRef>>, | ||
pub request_bodies: Option<HashMap<String, RelRef>>, | ||
pub headers: Option<HashMap<String, RelRef>>, | ||
pub security_schemes: Option<HashMap<String, RelRef>>, | ||
pub links: Option<HashMap<String, RelRef>>, | ||
pub callbacks: Option<HashMap<String, RelRef>>, | ||
pub extensions: Option<HashMap<String, Value>>, | ||
} |
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,13 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use std::collections::HashMap; | ||
use serde_json::Value; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)] | ||
pub struct Encoding { | ||
pub content_type: Option<String>, | ||
pub headers: Option<HashMap<String, RelRef>>, | ||
pub style: Option<String>, | ||
pub explode: Option<bool>, | ||
pub allow_reserved: Option<bool>, | ||
pub extensions: Option<HashMap<String, Value>>, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use std::collections::HashMap; | ||
use serde::{Deserialize, Serialize}; | ||
use serde_json::Value; | ||
use crate::new_oas::schema::Schema; | ||
|
||
// https://spec.openapis.org/oas/v3.1.0#media-type-object | ||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)] | ||
pub struct MediaType { | ||
pub schema: Option<Schema>, | ||
pub example: Option<Value>, | ||
pub examples: Option<HashMap<String, RelRef>>, | ||
pub encoding: Option<HashMap<String, crate::new_oas::encoding::Encoding>>, | ||
pub extensions: Option<HashMap<String, Value>>, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use serde::{Deserialize,Serialize}; | ||
use std::collections::HashMap; | ||
|
||
// https://spec.openapis.org/oas/v3.1.0#operation-object | ||
#[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<crate::new_oas::external_docs::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<crate::new_oas::responses::Responses>, | ||
pub callbacks: Option<HashMap<String, RelRef>>, | ||
pub deprecated: Option<bool>, | ||
pub security: Option<Vec<crate::new_oas::security::Security>>, | ||
pub servers: Option<Vec<crate::new_oas::server::Server>>, | ||
} | ||
|
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,33 @@ | ||
use serde::{Deserialize,Serialize}; | ||
use serde_json::Value; | ||
use std::collections::HashMap; | ||
|
||
// https://spec.openapis.org/oas/v3.1.0#parameter-object | ||
#[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 MediaType { | ||
pub schema: Option<Schema>, | ||
pub example: Option<Value>, | ||
pub examples: Option<HashMap<String, RelRef>>, | ||
pub encoding: Option<HashMap<String, Encoding>>, | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use std::collections::HashMap; | ||
use serde_json::Value; | ||
|
||
// https://spec.openapis.org/oas/v3.1.0#request-body-object | ||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)] | ||
pub struct RequestBody { | ||
pub description: Option<String>, | ||
pub content: HashMap<String, crate::new_oas::media_type::MediaType>, | ||
pub required: Option<bool>, | ||
pub extensions: Option<HashMap<String, Value>>, | ||
} |
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,20 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use std::collections::HashMap; | ||
|
||
// https://spec.openapis.org/oas/v3.1.0#responses-object | ||
#[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>>, | ||
pub extensions: Option<HashMap<String, Value>>, | ||
} |
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,10 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use std::collections::HashMap; | ||
use serde_json::Value; | ||
|
||
// https://spec.openapis.org/oas/v3.1.0#schema-object | ||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)] | ||
pub struct Schema{ | ||
|
||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
// https://spec.openapis.org/oas/v3.1.0#tag-object | ||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)] | ||
pub struct Tag { | ||
pub name: String, | ||
pub description: Option<String>, | ||
pub external_docs: Option<crate::new_oas::external_docs::ExternalDocs>, | ||
pub extensions: Option<serde_json::Value>, | ||
} |