product_os_openapi/
lib.rs

1#![no_std]
2extern crate no_std_compat as std;
3extern crate alloc;
4
5use std::prelude::v1::*;
6
7use std::collections::BTreeMap;
8use std::fmt;
9use serde::{Deserialize, Serialize};
10
11
12#[derive(Clone, Debug, Deserialize, Serialize)]
13#[serde(rename_all = "camelCase")]
14pub struct ProductOSOpenAPI {
15    pub openapi: Option<String>,
16    pub info: Info,
17    pub json_schema_dialect: Option<String>,
18    pub servers: Option<Vec<Server>>,
19    pub paths: Option<BTreeMap<String, PathItem>>, // path, method, path details
20    pub webhooks: Option<BTreeMap<String, PathItem>>,
21    pub components: Option<Components>,
22    pub definitions: Option<BTreeMap<String, Schema>>,
23    pub security: Option<Vec<BTreeMap<String, Vec<String>>>>,
24    pub tags: Option<Vec<Tag>>,
25    pub external_docs: Option<ExternalDocs>,
26
27    // openapi	string	REQUIRED. This string MUST be the version number of the OpenAPI Specification that the OpenAPI document uses. The openapi field SHOULD be used by tooling to interpret the OpenAPI document. This is not related to the API info.version string.
28    // info	Info Object	REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.
29    // jsonSchemaDialect	string	The default value for the $schema keyword within Schema Objects contained within this OAS document. This MUST be in the form of a URI.
30    // servers	[Server Object]	An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
31    // paths	Paths Object	The available paths and operations for the API.
32    // webhooks	Map[string, Path Item Object | Reference Object] ]	The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the callbacks feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An example is available.
33    // components	Components Object	An element to hold various schemas for the document.
34    // definitions - v2 version of storing schemas
35    // security	[Security Requirement Object]	A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement ({}) can be included in the array.
36    // tags	[Tag Object]	A list of tags used by the document with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.
37    // externalDocs	External Documentation Object	Additional external documentation.
38
39
40    pub swagger: Option<String>,
41    pub host: Option<String>,
42    // info
43    pub base_path: Option<String>,
44    pub schemes: Option<Vec<String>>,
45    pub consumes: Option<Vec<String>>,
46    pub produces: Option<Vec<String>>,
47    // paths
48
49    // swagger	string	Required. Specifies the Swagger Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be "2.0".
50    // info	Info Object	Required. Provides metadata about the API. The metadata can be used by the clients if needed.
51    // host	string	The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the host is not included, the host serving the documentation is to be used (including the port). The host does not support path templating.
52    // basePath	string	The base path on which the API is served, which is relative to the host. If it is not included, the API is served directly under the host. The value MUST start with a leading slash (/). The basePath does not support path templating.
53    // schemes	[string]	The transfer protocol of the API. Values MUST be from the list: "http", "https", "ws", "wss". If the schemes is not included, the default scheme to be used is the one used to access the Swagger definition itself.
54    // consumes	[string]	A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under Mime Types.
55    // produces	[string]	A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under Mime Types.
56    // paths	Paths Object	Required. The available paths and operations for the API.
57    // definitions	Definitions Object	An object to hold data types produced and consumed by operations.
58    // parameters	Parameters Definitions Object	An object to hold parameters that can be used across operations. This property does not define global parameters for all operations.
59    // responses	Responses Definitions Object	An object to hold responses that can be used across operations. This property does not define global responses for all operations.
60    // securityDefinitions	Security Definitions Object	Security scheme definitions that can be used across the specification.
61    // security	[Security Requirement Object]	A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition.
62    // tags	[Tag Object]	A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.
63    // externalDocs	External Documentation Object	Additional external documentation.
64}
65
66#[derive(Clone, Debug, Deserialize, Serialize)]
67#[serde(rename_all = "camelCase")]
68pub struct Info {
69    pub title: String,
70    pub summary: Option<String>,
71    pub description: Option<String>,
72    pub terms_of_service: Option<String>,
73    pub contact: Option<Contact>,
74    pub license: Option<License>,
75    pub version: String,
76    // title	string	REQUIRED. The title of the API.
77    // summary	string	A short summary of the API.
78    // description	string	A description of the API. CommonMark syntax MAY be used for rich text representation.
79    // termsOfService	string	A URL to the Terms of Service for the API. This MUST be in the form of a URL.
80    // contact	Contact Object	The contact information for the exposed API.
81    // license	License Object	The license information for the exposed API.
82    // version	string	REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
83}
84
85#[derive(Clone, Debug, Deserialize, Serialize)]
86#[serde(rename_all = "camelCase")]
87pub struct Contact {
88    pub name: Option<String>,
89    pub url: Option<String>,
90    pub email: String
91}
92
93#[derive(Clone, Debug, Deserialize, Serialize)]
94#[serde(rename_all = "camelCase")]
95pub struct License {
96    pub name: String,
97    pub identifier: Option<String>,
98    pub url: Option<String>
99}
100
101#[derive(Clone, Debug, Deserialize, Serialize)]
102#[serde(rename_all = "camelCase")]
103pub struct Server {
104    pub url: String,
105    pub description: Option<String>,
106    pub variables: Option<BTreeMap<String, ServerVariable>>
107}
108
109#[derive(Clone, Debug, Deserialize, Serialize)]
110#[serde(rename_all = "camelCase")]
111pub struct ServerVariable {
112    #[serde(rename = "enum")]
113    pub enumeration: Option<Vec<String>>,
114    pub default: String,
115    pub description: Option<String>
116}
117
118#[derive(Clone, Debug, Deserialize, Serialize)]
119#[serde(rename_all = "camelCase")]
120pub struct Components {
121    pub schemas: Option<BTreeMap<String, Schema>>,	// Map[string, Schema Object]	An object to hold reusable Schema Objects.
122    pub responses: Option<BTreeMap<String, Response>>,	// Map[string, Response Object | Reference Object]	An object to hold reusable Response Objects.
123    pub parameters: Option<BTreeMap<String, Parameter>>,	// Map[string, Parameter Object | Reference Object]	An object to hold reusable Parameter Objects.
124    pub examples: Option<BTreeMap<String, Example>>,	// Map[string, Example Object | Reference Object]	An object to hold reusable Example Objects.
125    pub request_bodies: Option<BTreeMap<String, RequestBody>>,	// Map[string, Request Body Object | Reference Object]	An object to hold reusable Request Body Objects.
126    pub headers: Option<BTreeMap<String, Header>>,	// Map[string, Header Object | Reference Object]	An object to hold reusable Header Objects.
127    pub security_schemes: Option<BTreeMap<String, SecurityScheme>>,	// Map[string, Security Scheme Object | Reference Object]	An object to hold reusable Security Scheme Objects.
128    pub links: Option<BTreeMap<String, Link>>,	// Map[string, Link Object | Reference Object]	An object to hold reusable Link Objects.
129    pub callbacks: Option<BTreeMap<String, BTreeMap<String, BTreeMap<String, PathItem>>>>,	// Map[string, Callback Object | Reference Object]	An object to hold reusable Callback Objects.
130    pub path_items: Option<BTreeMap<String, PathItem>>, // path, method, path details	// Map[string, Path Item Object | Reference Object]	An object to hold reusable Path Item Object.
131}
132
133#[derive(Clone, Debug, Deserialize, Serialize)]
134#[serde(rename_all = "camelCase")]
135pub struct PathItem {
136    #[serde(rename = "$ref")]
137    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
138    pub summary: Option<String>, // summary	string	A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect.
139    pub description: Option<String>, // description	string	A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.
140
141    pub get: Option<Operation>,
142    pub put: Option<Operation>,
143    pub post: Option<Operation>,
144    pub delete: Option<Operation>,
145    pub options: Option<Operation>,
146    pub head: Option<Operation>,
147    pub patch: Option<Operation>,
148    pub trace: Option<Operation>,
149
150    pub servers: Option<Vec<Server>>,
151    pub parameters: Option<Vec<Parameter>>
152    // get	Operation Object	A definition of a GET operation on this path.
153    // put	Operation Object	A definition of a PUT operation on this path.
154    // post	Operation Object	A definition of a POST operation on this path.
155    // delete	Operation Object	A definition of a DELETE operation on this path.
156    // options	Operation Object	A definition of a OPTIONS operation on this path.
157    // head	Operation Object	A definition of a HEAD operation on this path.
158    // patch	Operation Object	A definition of a PATCH operation on this path.
159    // trace	Operation Object	A definition of a TRACE operation on this path.
160    // servers	[Server Object]	An alternative server array to service all operations in this path.
161    // parameters	[Parameter Object | Reference Object]	A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object's components/parameters.
162}
163
164
165#[derive(Clone, Debug, Deserialize, Serialize)]
166#[serde(rename_all = "lowercase")]
167pub enum SchemaType {
168    Object,
169    Number,
170    Integer,
171    String,
172    Boolean,
173    Array
174}
175
176impl fmt::Display for SchemaType {
177    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
178        match self {
179            SchemaType::Object => write!(f, "object"),
180            SchemaType::Number => write!(f, "number"),
181            SchemaType::Integer => write!(f, "integer"),
182            SchemaType::String => write!(f, "string"),
183            SchemaType::Boolean => write!(f, "boolean"),
184            SchemaType::Array => write!(f, "array")
185        }
186    }
187}
188
189
190#[derive(Clone, Debug, Deserialize, Serialize)]
191#[serde(rename_all = "lowercase")]
192pub enum SchemaLocation {
193    Path,
194    Body,
195    Query,
196    Cookie
197}
198
199
200#[derive(Clone, Debug, Deserialize, Serialize)]
201#[serde(rename_all = "camelCase")]
202pub struct Schema {
203    #[serde(rename = "$ref")]
204    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
205
206    // https://www.mongodb.com/basics/json-schema-examples
207    // $schema: States that this schema complies with v4 of the IETF standard
208    // $id: Defines the base URI to resolve other URI references within the schema.
209    pub title: Option<String>, // title: Describes the intent of the schema.
210    pub description: Option<String>, // description: Gives the description of the schema.
211
212    pub all_of: Option<Vec<Box<Schema>>>, // composition of schemas
213
214    #[serde(rename = "type")]
215    pub kind: Option<SchemaType>, // type: Defines the type of data, can be optional if using a reference instead
216    pub format: Option<String>, // type: Defines the type of data, can be optional if using a reference instead
217    pub properties: Option<BTreeMap<String, SchemaProperty>>, // properties: Defines various keys and their value types within a JSON document.
218    pub minimum: Option<u64>, // minimum: Defines the minimum acceptable value for a numeric datatype.
219    pub maximum: Option<u64>, // minimum: Defines the minimum acceptable value for a numeric datatype.
220    pub items: Option<Box<Schema>>, // items: Enumerates the definition for the items that can appear in an array.
221    pub min_items: Option<u64>, // minItems: Defines the minimum number of items that should appear in an array.
222    pub max_items: Option<u64>, // minItems: Defines the minimum number of items that should appear in an array.
223    pub unique_items: Option<bool>, // uniqueItems: Enforces if every item in the array should be unique relative to one another.
224    pub min_length: Option<u64>, // minLength: define a string length minimum
225    pub max_length: Option<u64>, // minLength: define a string length minimum
226    pub required: Option<Vec<String>>, // required: Lists the keys that are required and mandatory.
227    // pub additional_properties: Option<bool>, // additionalProperties - determines if strict on properties allowed
228
229    pub discriminator: Option<Discriminator>, // discriminator	Discriminator Object	Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details.
230    pub xml: Option<XML>, // xml	XML Object	This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
231    pub external_docs: Option<ExternalDocs>, // externalDocs	External Documentation Object	Additional external documentation for this schema.
232    pub example: Option<serde_json::Value>, // example	Any	A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
233}
234
235
236#[derive(Clone, Debug, Deserialize, Serialize)]
237#[serde(rename_all = "camelCase")]
238pub struct SchemaProperty {
239    #[serde(rename = "$ref")]
240    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
241
242    pub description: Option<String>, // description: Gives the description of the schema.
243
244    pub all_of: Option<Vec<Box<SchemaProperty>>>, // composition of schemas
245
246    #[serde(rename = "type")]
247    pub kind: Option<SchemaType>, // type: Defines the type of data, can be optional if using a reference instead
248    pub minimum: Option<u64>, // minimum: Defines the minimum acceptable value for a numeric datatype.
249    pub items: Option<Box<Schema>>, // items: Enumerates the definition for the items that can appear in an array.
250    pub min_items: Option<u64>, // minItems: Defines the minimum number of items that should appear in an array.
251    pub unique_items: Option<bool>, // uniqueItems: Enforces if every item in the array should be unique relative to one another.
252    pub min_length: Option<u64>, // minLength: define a string length minimum
253    pub required: Option<Vec<String>>, // required: Lists the keys that are required and mandatory.
254}
255
256
257
258#[derive(Clone, Debug, Deserialize, Serialize)]
259#[serde(rename_all = "camelCase")]
260pub struct Discriminator {
261    pub property_name: String, // propertyName	string	REQUIRED. The name of the property in the payload that will hold the discriminator value.
262    pub mapping: Option<BTreeMap<String, String>> // mapping	Map[string, string]	An object to hold mappings between payload values and schema names or references.
263}
264
265#[derive(Clone, Debug, Deserialize, Serialize)]
266#[serde(rename_all = "camelCase")]
267// Poorly defined still
268pub struct XML {
269    pub name: Option<String>, // name	string	Replaces the name of the element/attribute used for the described schema property. When defined within items, it will affect the name of the individual XML elements within the list. When defined alongside type being array (outside the items), it will affect the wrapping element and only if wrapped is true. If wrapped is false, it will be ignored.
270    pub namespace: Option<String>, // namespace	string	The URI of the namespace definition. This MUST be in the form of an absolute URI.
271    pub prefix: Option<String>, // prefix	string	The prefix to be used for the name.
272    pub attribute: Option<bool>, // attribute	boolean	Declares whether the property definition translates to an attribute instead of an element. Default value is false.
273    pub wrapped: Option<bool>, // wrapped	boolean	MAY be used only for an array definition. Signifies whether the array is wrapped (for example, <books><book/><book/></books>) or unwrapped (<book/><book/>). Default value is false. The definition takes effect only when defined alongside type being array (outside the items).
274}
275
276
277#[derive(Clone, Debug, Deserialize, Serialize)]
278#[serde(rename_all = "camelCase")]
279pub struct Operation {
280    pub tags: Option<Vec<String>>, // tags	[string]	A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
281    pub summary: Option<String>, // summary	string	A short summary of what the operation does.
282    pub description: Option<String>, // description	string	A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
283    pub external_docs: Option<ExternalDocs>, // externalDocs	External Documentation Object	Additional external documentation for this operation.
284    pub operation_id: Option<String>, // operationId	string	Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is case-sensitive. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.
285    pub parameters: Option<Vec<Parameter>>, // parameters	[Parameter Object | Reference Object]	A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object's components/parameters.
286    pub request_body: Option<RequestBody>, // requestBody	Request Body Object | Reference Object	The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the HTTP 1.1 specification RFC7231 has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as GET, HEAD and DELETE), requestBody is permitted but does not have well-defined semantics and SHOULD be avoided if possible.
287    pub responses: Option<BTreeMap<String, Response>>, // responses	Responses Object	The list of possible responses as they are returned from executing this operation using either default or http status code
288    pub callbacks: Option<BTreeMap<String, BTreeMap<String, PathItem>>>, // callbacks	Map[string, Callback Object | Reference Object]	A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses.
289    pub deprecated: Option<bool>, // deprecated	boolean	Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false.
290    pub security: Option<Vec<BTreeMap<String, Vec<String>>>>, // security	[Security Requirement Object]	A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement ({}) can be included in the array. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
291    pub servers: Option<Server>, // servers	[Server Object]	An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
292}
293
294
295#[derive(Clone, Debug, Deserialize, Serialize)]
296#[serde(rename_all = "camelCase")]
297pub struct Response {
298    #[serde(rename = "$ref")]
299    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
300    pub summary: Option<String>, // summary	string	A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect.
301    pub description: Option<String>, // description	string	A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.
302
303    // pub description: String, // description	string	REQUIRED. A description of the response. CommonMark syntax MAY be used for rich text representation.
304    pub headers: Option<BTreeMap<String, Header>>, // headers	Map[string, Header Object | Reference Object]	Maps a header name to its definition. RFC7230 states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
305    pub content: Option<BTreeMap<String, MediaType>>, // content	Map[string, Media Type Object]	A map containing descriptions of potential response payloads. The key is a media type or media type range and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
306    pub links: Option<BTreeMap<String, Link>>, // links	Map[string, Link Object | Reference Object]	A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.
307    pub schema: Option<Schema>, // v2 handling for reference
308}
309
310#[derive(Clone, Debug, Deserialize, Serialize)]
311#[serde(rename_all = "camelCase")]
312pub struct Parameter {
313    #[serde(rename = "$ref")]
314    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
315    pub summary: Option<String>, // summary	string	A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect.
316    pub description: Option<String>, // description	string	A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.
317
318    pub name: Option<String>, // name	string	REQUIRED. The name of the parameter. Parameter names are case sensitive.
319    #[serde(rename = "in")]
320    pub location: Option<String>, // in	string	REQUIRED. The location of the parameter. Possible values are "query", "header", "path" or "cookie".
321    // pub description: Option<String>, // description	string	A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
322    pub required: Option<bool>, // required	boolean	Determines whether this parameter is mandatory. If the parameter location is "path", this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
323    pub deprecated: Option<bool>, // deprecated	boolean	Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is false.
324    pub allow_empty_value: Option<bool>, // allowEmptyValue	boolean	Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
325
326    pub style: Option<String>, // style	string	Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
327    // matrix	primitive, array, object	path	Path-style parameters defined by RFC6570
328    // label	primitive, array, object	path	Label style parameters defined by RFC6570
329    // form	primitive, array, object	query, cookie	Form style parameters defined by RFC6570. This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0.
330    // simple	array	path, header	Simple style parameters defined by RFC6570. This option replaces collectionFormat with a csv value from OpenAPI 2.0.
331    // spaceDelimited	array, object	query	Space separated array or object values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0.
332    // pipeDelimited	array, object	query	Pipe separated array or object values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0.
333    // deepObject	object	query	Provides a simple way of rendering nested objects using form parameters.
334
335    pub explode: Option<bool>, // explode	boolean	When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
336    pub allow_reserved: Option<bool>, // allowReserved	boolean	Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
337    pub schema: Option<Schema>, // schema	Schema Object	The schema defining the type used for the parameter.
338    pub example: Option<serde_json::Value>, // example	Any	Example of the parameter's potential value. The example SHOULD match the specified schema and encoding properties if present. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema that contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
339    pub examples: Option<BTreeMap<String, Example>>, // examples	Map[ string, Example Object | Reference Object]	Examples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema that contains an example, the examples value SHALL override the example provided by the schema.
340    pub content: Option<BTreeMap<String, MediaType>>, // content	Map[string, Media Type Object]	A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
341}
342
343
344#[derive(Clone, Debug, Deserialize, Serialize)]
345#[serde(rename_all = "camelCase")]
346pub struct Example {
347    #[serde(rename = "$ref")]
348    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
349    pub summary: Option<String>, // summary	string	A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect.
350    pub description: Option<String>, // description	string	A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.
351
352    // pub summary: Option<String>, // summary	string	Short description for the example.
353    // pub description: Option<String>, // description	string	Long description for the example. CommonMark syntax MAY be used for rich text representation.
354    pub value: Option<serde_json::Value>, // value	Any	Embedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
355    pub external_value: Option<String> // externalValue	string	A URI that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive. See the rules for resolving Relative References.
356}
357
358
359#[derive(Clone, Debug, Deserialize, Serialize)]
360#[serde(rename_all = "camelCase")]
361pub struct RequestBody {
362    #[serde(rename = "$ref")]
363    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
364    pub summary: Option<String>, // summary	string	A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect.
365    pub description: Option<String>, // description	string	A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.
366
367    // pub description: Option<String>, // description	string	A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
368    pub content: BTreeMap<String, MediaType>, // content	Map[string, Media Type Object]	REQUIRED. The content of the request body. The key is a media type or media type range and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
369    pub required: Option<bool>, // required	boolean	Determines if the request body is required in the request. Defaults to false.
370}
371
372#[derive(Clone, Debug, Deserialize, Serialize)]
373#[serde(rename_all = "camelCase")]
374pub struct Header {
375    #[serde(rename = "$ref")]
376    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
377    pub summary: Option<String>, // summary	string	A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect.
378    pub description: Option<String>, // description	string	A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.
379
380    // pub description: Option<String>, // description	string	A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
381    pub required: Option<bool>, // required	boolean	Determines whether this parameter is mandatory. If the parameter location is "path", this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
382    pub deprecated: Option<bool>, // deprecated	boolean	Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is false.
383    pub allow_empty_value: Option<bool>, // allowEmptyValue	boolean	Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
384    pub style: Option<String>, // style	string	Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
385
386    pub explode: Option<bool>, // explode	boolean	When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
387    pub allow_reserved: Option<bool>, // allowReserved	boolean	Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
388    pub schema: Option<Schema>, // schema	Schema Object	The schema defining the type used for the parameter.
389    pub example: Option<serde_json::Value>, // example	Any	Example of the parameter's potential value. The example SHOULD match the specified schema and encoding properties if present. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema that contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
390    pub examples: Option<BTreeMap<String, Example>>, // examples	Map[ string, Example Object | Reference Object]	Examples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema that contains an example, the examples value SHALL override the example provided by the schema.
391    pub content: Option<BTreeMap<String, MediaType>>, // content	Map[string, Media Type Object]	A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
392}
393
394#[derive(Clone, Debug, Deserialize, Serialize)]
395#[serde(rename_all = "camelCase")]
396pub struct MediaType {
397    pub schema: Option<Schema>, // schema	Schema Object	The schema defining the content of the request, response, or parameter.
398    pub example: Option<serde_json::Value>, // example	Any	Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
399    pub examples: Option<BTreeMap<String, Example>>, // examples	Map[ string, Example Object | Reference Object]	Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
400    pub encoding: Option<BTreeMap<String, Encoding>>, // encoding	Map[string, Encoding Object]	A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
401}
402
403#[derive(Clone, Debug, Deserialize, Serialize)]
404#[serde(rename_all = "camelCase")]
405pub struct Encoding {
406    pub content_type: Option<String>, // contentType	string	The Content-Type for encoding a specific property. Default value depends on the property type: for object - application/json; for array – the default is defined based on the inner type; for all other cases the default is application/octet-stream. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
407    pub headers: Option<BTreeMap<String, Header>>, // headers	Map[string, Header Object | Reference Object]	A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.
408    pub style: Option<String>, // style	string	Describes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded or multipart/form-data. If a value is explicitly defined, then the value of contentType (implicit or explicit) SHALL be ignored.
409    pub explode: Option<bool>, // explode	boolean	When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded or multipart/form-data. If a value is explicitly defined, then the value of contentType (implicit or explicit) SHALL be ignored.
410    pub allow_reserved: Option<bool> // allowReserved	boolean	Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded or multipart/form-data. If a value is explicitly defined, then the value of contentType (implicit or explicit) SHALL be ignored.
411}
412
413#[derive(Clone, Debug, Deserialize, Serialize)]
414#[serde(rename_all = "camelCase")]
415pub struct SecurityScheme {
416    #[serde(rename = "$ref")]
417    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
418    pub summary: Option<String>, // summary	string	A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect.
419    pub description: Option<String>, // description	string	A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.
420
421    #[serde(rename = "type")]
422    pub kind: String, // type	string	Any	REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect".
423    // pub description: Option<String>, // description	string	Any	A description for security scheme. CommonMark syntax MAY be used for rich text representation.
424    pub api_key: Option<String>, // name	string	apiKey	REQUIRED. The name of the header, query or cookie parameter to be used.
425
426    #[serde(rename = "in")]
427    pub location: Option<String>, // REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
428    pub scheme: String, // scheme	string	http	REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry.
429    pub bearer_format: Option<String>, // bearerFormat	string	http ("bearer")	A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
430    pub flows: Option<OAuthFlows>, // flows	OAuth Flows Object	oauth2	REQUIRED. An object containing configuration information for the flow types supported.
431    pub open_id_connect_url: Option<String>, // openIdConnectUrl	string	openIdConnect	REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. The OpenID Connect standard requires the use of TLS.
432}
433
434#[derive(Clone, Debug, Deserialize, Serialize)]
435#[serde(rename_all = "camelCase")]
436pub struct OAuthFlows {
437    pub implicit: Option<OAuthFlow>, // implicit	OAuth Flow Object	Configuration for the OAuth Implicit flow
438    pub password: Option<OAuthFlow>, // password	OAuth Flow Object	Configuration for the OAuth Resource Owner Password flow
439    pub client_credentials: Option<OAuthFlow>, //  clientCredentials	OAuth Flow Object	Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
440    pub authorization_code: Option<OAuthFlow>, // authorizationCode	OAuth Flow Object	Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
441}
442
443#[derive(Clone, Debug, Deserialize, Serialize)]
444#[serde(rename_all = "camelCase")]
445pub struct OAuthFlow {
446    pub authorization_url: String, // authorizationUrl	string	oauth2 ("implicit", "authorizationCode")	REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.
447    pub token_url: String, // tokenUrl	string	oauth2 ("password", "clientCredentials", "authorizationCode")	REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.
448    pub refresh_url: Option<String>, // refreshUrl	string	oauth2	The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.
449    pub scopes: BTreeMap<String, String> // scopes	Map[string, string]	oauth2	REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty
450}
451
452#[derive(Clone, Debug, Deserialize, Serialize)]
453#[serde(rename_all = "camelCase")]
454pub struct Link {
455    #[serde(rename = "$ref")]
456    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
457    pub summary: Option<String>, // summary	string	A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect.
458    pub description: Option<String>, // description	string	A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.
459
460    pub operation_ref: Option<String>, // operationRef	string	A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition. See the rules for resolving Relative References.
461    pub operation_id: Option<String>, // operationId	string	The name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
462    pub parameters: Option<BTreeMap<String, serde_json::Value>>, // parameters	Map[string, Any | {expression}]	A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
463    pub request_body: Option<serde_json::Value>, // requestBody	Any | {expression}	A literal value or {expression} to use as a request body when calling the target operation.
464    // pub description: Option<String>, // description	string	A description of the link. CommonMark syntax MAY be used for rich text representation.
465    pub server: Option<Server>, // server	Server Object	A server object to be used by the target operation.
466}
467
468#[derive(Clone, Debug, Deserialize, Serialize)]
469#[serde(rename_all = "camelCase")]
470pub struct Tag {
471    pub name: String, // name	string	REQUIRED. The name of the tag.
472    pub description: Option<String>, // description	string	A description for the tag. CommonMark syntax MAY be used for rich text representation.
473    pub external_docs: Option<ExternalDocs>, // externalDocs	External Documentation Object	Additional external documentation for this tag.
474}
475
476
477#[derive(Clone, Debug, Deserialize, Serialize)]
478#[serde(rename_all = "camelCase")]
479pub struct ExternalDocs {
480    pub url: String,
481    pub description: Option<String>
482}
483
484#[derive(Clone, Debug, Deserialize, Serialize)]
485#[serde(rename_all = "camelCase")]
486pub struct Reference {
487    #[serde(rename = "$ref")]
488    pub reference: Option<String>, // $ref	string	REQUIRED. The reference identifier. This MUST be in the form of a URI.
489    pub summary: Option<String>, // summary	string	A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect.
490    pub description: Option<String> // description	string	A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.
491}
492