openapi_schema/v3/
schema.rs

1use std::collections::BTreeMap;
2
3use crate::extension::Extensions;
4use serde::{Deserialize, Serialize};
5use serde_json::{Number, Value};
6
7/// # OpenApi
8/// This is the root document object of the OpenAPI document.
9/// see https://swagger.io/specification/v3/
10#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
11pub struct OpenApi {
12    /// This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses.
13    pub openapi: String,
14    /// Provides metadata about the API.
15    pub info: Info,
16    /// An array of Server Objects, which provide connectivity information to a target server.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub servers: Option<Vec<Server>>,
19
20    pub paths: Paths,
21
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub components: Option<Components>,
24
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub security: Option<SecurityRequirement>,
27
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub tags: Option<Vec<Tag>>,
30
31    /// Additional external documentation.
32    #[serde(skip_serializing_if = "Option::is_none", rename = "externalDocs")]
33    pub external_docs: Option<ExternalDoc>,
34}
35/// ## Info
36/// The object provides metadata about the API.
37#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
38pub struct Info {
39    ///  The title of the application.
40    pub title: String,
41    /// A short description of the application.
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub description: Option<String>,
44    /// The Terms of Service for the API.
45    #[serde(rename = "termsOfService", skip_serializing_if = "Option::is_none")]
46    pub terms_of_service: Option<String>,
47    /// The contact information for the exposed API.
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub contact: Option<Contact>,
50    /// The license information for the exposed API.
51    #[serde(skip_serializing_if = "Option::is_none")]
52    pub license: Option<License>,
53    /// Provides the version of the application API (not to be confused with the specification version).
54    #[serde(skip_serializing_if = "Option::is_none")]
55    pub version: Option<String>,
56
57    #[serde(flatten)]
58    pub extensions: Extensions,
59}
60
61/// ### Contact
62/// Contact information for the exposed API.
63#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
64pub struct Contact {
65    /// The identifying name of the contact person/organization.
66    #[serde(skip_serializing_if = "Option::is_none")]
67    pub name: Option<String>,
68    /// The URL pointing to the contact information. MUST be in the format of a URL.
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub url: Option<String>,
71    /// The email address of the contact person/organization.
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub email: Option<String>,
74
75    #[serde(flatten)]
76    pub extensions: Extensions,
77}
78
79/// ### License
80/// License information for the exposed API.
81#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
82pub struct License {
83    /// The license name used for the API.
84    pub name: String,
85    /// A URL to the license used for the API. MUST be in the format of a URL.
86    #[serde(skip_serializing_if = "Option::is_none")]
87    pub url: Option<String>,
88
89    #[serde(flatten)]
90    pub extensions: Extensions,
91}
92
93/// ## Server
94/// An object representing a Server.
95#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
96pub struct Server {
97    ///  A URL to the target host.
98    pub url: String,
99    /// An optional string describing the host designated by the URL.
100    #[serde(skip_serializing_if = "Option::is_none")]
101    pub description: Option<String>,
102    /// A map between a variable name and its value. The value is used for substitution in the server's URL template.
103    #[serde(skip_serializing_if = "Option::is_none")]
104    pub variables: Option<BTreeMap<String, ServerVariable>>,
105
106    #[serde(flatten)]
107    pub extensions: Extensions,
108}
109
110/// ### ServerVariable
111/// An object representing a Server Variable for server URL template substitution.
112#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
113pub struct ServerVariable {
114    /// An enumeration of string values to be used if the substitution options are from a limited set.
115    #[serde(skip_serializing_if = "Option::is_none")]
116    pub r#enum: Option<Vec<String>>,
117    /// The default value to use for substitution, which SHALL be sent if an alternate value is *not* supplied.
118    pub default: String,
119    /// An optional description for the server variable.
120    #[serde(skip_serializing_if = "Option::is_none")]
121    pub description: Option<String>,
122
123    #[serde(flatten)]
124    pub extensions: Extensions,
125}
126/// # Components
127/// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
128#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
129pub struct Components {
130    /// An object to hold reusable Schema Objects.
131    #[serde(skip_serializing_if = "Option::is_none")]
132    pub schemas: Option<BTreeMap<String, RefOrObject<Schema>>>,
133    /// An object to hold reusable Response Objects.
134    #[serde(skip_serializing_if = "Option::is_none")]
135    pub responses: Option<Responses>,
136    /// An object to hold reusable Parameter Objects.
137    #[serde(skip_serializing_if = "Option::is_none")]
138    pub parameters: Option<BTreeMap<String, RefOrObject<Parameter>>>,
139    /// An object to hold reusable Example Objects.
140    #[serde(skip_serializing_if = "Option::is_none")]
141    pub examples: Option<BTreeMap<String, RefOrObject<Example>>>,
142    /// An object to hold reusable Request Body Objects.
143    #[serde(skip_serializing_if = "Option::is_none", rename = "requestBodies")]
144    pub request_bodies: Option<BTreeMap<String, RefOrObject<RequestBody>>>,
145    /// An object to hold reusable Header Objects.
146    #[serde(skip_serializing_if = "Option::is_none")]
147    pub headers: Option<BTreeMap<String, RefOrObject<Header>>>,
148    /// An object to hold reusable Security Scheme Objects.
149    #[serde(skip_serializing_if = "Option::is_none", rename = "securitySchemes")]
150    pub security_schemes: Option<BTreeMap<String, RefOrObject<SecurityScheme>>>,
151    /// An object to hold reusable Link Objects.
152    #[serde(skip_serializing_if = "Option::is_none")]
153    pub links: Option<BTreeMap<String, RefOrObject<Link>>>,
154    /// An object to hold reusable Callback Objects.
155    #[serde(skip_serializing_if = "Option::is_none")]
156    pub callbacks: Option<BTreeMap<String, RefOrObject<Callback>>>,
157
158    #[serde(flatten)]
159    pub extensions: Extensions,
160}
161
162/// ### Paths
163/// Holds the relative paths to the individual endpoints and their operations.
164///
165/// The path is appended to the URL from the Server Object in order to construct the full URL.
166///
167/// The Paths MAY be empty, due to [ACL constraints](https://swagger.io/specification/v3/#security-filtering).
168pub type Paths = BTreeMap<String, PathItem>;
169
170/// ### Path Item
171/// Describes the operations available on a single path.
172#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
173pub struct PathItem {
174    /// Allows for an external definition of this path item. The referenced structure MUST be in the format of a Path Item Object.
175    /// If there are conflicts between the referenced definition and this Path Item's definition, the behavior is undefined.
176    #[serde(rename = "$ref", skip_serializing_if = "Option::is_none")]
177    pub reference: Option<String>,
178    /// An optional, string summary, intended to apply to all operations in this path.
179    #[serde(skip_serializing_if = "Option::is_none")]
180    pub summary: Option<String>,
181    /// An optional, string description, intended to apply to all operations in this path.
182    #[serde(skip_serializing_if = "Option::is_none")]
183    pub description: Option<String>,
184    /// A definition of a GET operation on this path.
185    #[serde(skip_serializing_if = "Option::is_none")]
186    pub get: Option<Operation>,
187    /// A definition of a GET operation on this path.
188    #[serde(skip_serializing_if = "Option::is_none")]
189    pub put: Option<Operation>,
190    /// A definition of a GET operation on this path.
191    #[serde(skip_serializing_if = "Option::is_none")]
192    pub post: Option<Operation>,
193    /// A definition of a GET operation on this path.
194    #[serde(skip_serializing_if = "Option::is_none")]
195    pub delete: Option<Operation>,
196    /// A definition of a GET operation on this path.
197    #[serde(skip_serializing_if = "Option::is_none")]
198    pub options: Option<Operation>,
199    /// A definition of a GET operation on this path.
200    #[serde(skip_serializing_if = "Option::is_none")]
201    pub head: Option<Operation>,
202    /// A definition of a GET operation on this path.
203    #[serde(skip_serializing_if = "Option::is_none")]
204    pub patch: Option<Operation>,
205    /// A definition of a TRACE operation on this path.
206    #[serde(skip_serializing_if = "Option::is_none")]
207    pub trace: Option<Operation>,
208    /// An alternative server array to service all operations in this path.
209    #[serde(skip_serializing_if = "Option::is_none")]
210    pub servers: Option<Vec<Server>>,
211
212    /// A list of parameters that are applicable for all the operations described under this path.
213    #[serde(skip_serializing_if = "Option::is_none")]
214    pub parameters: Option<Vec<RefOrObject<Parameter>>>,
215
216    #[serde(flatten)]
217    pub extensions: Extensions,
218}
219
220/// ### Operation
221/// Describes a single API operation on a path.
222#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
223pub struct Operation {
224    /// A list of tags for API documentation control.
225    #[serde(skip_serializing_if = "Option::is_none")]
226    pub tags: Option<Vec<String>>,
227    /// A short summary of what the operation does.
228    #[serde(skip_serializing_if = "Option::is_none")]
229    pub summary: Option<String>,
230    /// A verbose explanation of the operation behavior.
231    #[serde(skip_serializing_if = "Option::is_none")]
232    pub description: Option<String>,
233    /// Additional external documentation for this operation.
234    #[serde(skip_serializing_if = "Option::is_none", rename = "externalDocs")]
235    pub external_docs: Option<ExternalDoc>,
236    /// Unique string used to identify the operation.
237    #[serde(skip_serializing_if = "Option::is_none", rename = "operationId")]
238    pub operation_id: Option<String>,
239    /// A list of parameters that are applicable for this operation.
240    #[serde(skip_serializing_if = "Option::is_none")]
241    pub parameters: Option<Vec<RefOrObject<Parameter>>>,
242    /// The request body applicable for this operation.
243    #[serde(skip_serializing_if = "Option::is_none", rename = "requestBody")]
244    pub request_body: Option<RefOrObject<RequestBody>>,
245    /// The list of possible responses as they are returned from executing this operation.
246    pub responses: Responses,
247    /// A map of possible out-of band callbacks related to the parent operation.
248    #[serde(skip_serializing_if = "Option::is_none")]
249    pub callbacks: Option<BTreeMap<String, RefOrObject<Callback>>>,
250    /// Declares this operation to be deprecated.
251    #[serde(skip_serializing_if = "Option::is_none")]
252    pub deprecated: Option<bool>,
253    /// A declaration of which security mechanisms can be used for this operation.
254    #[serde(skip_serializing_if = "Option::is_none")]
255    pub security: Option<Vec<SecurityRequirement>>,
256    /// An alternative server array to service this operation.
257    #[serde(skip_serializing_if = "Option::is_none")]
258    pub servers: Option<Vec<Server>>,
259
260    #[serde(flatten)]
261    pub extensions: Extensions,
262}
263
264/// ### External Documentation
265/// Allows referencing an external resource for extended documentation.
266#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
267pub struct ExternalDoc {
268    /// A short description of the target documentation.
269    #[serde(skip_serializing_if = "Option::is_none")]
270    pub description: Option<String>,
271    /// he URL for the target documentation.
272    pub url: String,
273
274    #[serde(flatten)]
275    pub extensions: Extensions,
276}
277
278/// ## Parameter
279///
280/// Describes a single operation parameter.
281/// A unique parameter is defined by a combination of a name and location.
282#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
283pub struct Parameter {
284    /// The name of the parameter.
285    pub name: String,
286    /// The location of the parameter. Possible values are "query", "header", "path" or "cookie".
287    pub r#in: String,
288    /// A brief description of the parameter.
289    #[serde(skip_serializing_if = "Option::is_none")]
290    pub description: Option<String>,
291    /// Determines whether this parameter is mandatory.
292    #[serde(skip_serializing_if = "Option::is_none")]
293    pub required: Option<bool>,
294    /// Specifies that a parameter is deprecated and SHOULD be transitioned out of usage.
295    #[serde(skip_serializing_if = "Option::is_none")]
296    pub deprecated: Option<bool>,
297    /// Sets the ability to pass empty-valued parameters.
298    #[serde(skip_serializing_if = "Option::is_none", rename = "allowEmptyValue")]
299    pub allow_empty_value: Option<bool>,
300
301    ///Describes how the parameter value will be serialized depending on the type of the parameter value.
302    #[serde(skip_serializing_if = "Option::is_none")]
303    pub style: Option<String>,
304    /// 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.
305    #[serde(skip_serializing_if = "Option::is_none")]
306    pub explode: Option<bool>,
307
308    /// Determines whether the parameter value SHOULD allow reserved characters
309    #[serde(skip_serializing_if = "Option::is_none", rename = "allowReserved")]
310    pub allow_reserved: Option<bool>,
311
312    /// The schema defining the type used for the parameter.
313    #[serde(skip_serializing_if = "Option::is_none")]
314    pub schema: Option<RefOrObject<Schema>>,
315    /// Example of the parameter's potential value.
316    #[serde(skip_serializing_if = "Option::is_none")]
317    pub example: Option<Value>,
318    /// Examples of the parameter's potential value.
319    #[serde(skip_serializing_if = "Option::is_none")]
320    pub examples: Option<BTreeMap<String, RefOrObject<Example>>>,
321    /// A map containing the representations for the parameter.
322    #[serde(skip_serializing_if = "Option::is_none")]
323    pub content: Option<BTreeMap<String, Media>>,
324
325    #[serde(flatten)]
326    pub extensions: Extensions,
327}
328
329/// ### Request Body
330/// Describes a single request body.
331#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
332pub struct RequestBody {
333    /// A brief description of the request body.
334    #[serde(skip_serializing_if = "Option::is_none")]
335    pub description: Option<String>,
336    /// The content of the request body.
337    /// The key is a media type or media type range and the value describes it.
338    pub content: BTreeMap<String, Media>,
339    /// Determines if the request body is required in the request.
340    #[serde(skip_serializing_if = "Option::is_none")]
341    pub required: Option<bool>,
342
343    #[serde(flatten)]
344    pub extensions: Extensions,
345}
346
347/// ## Responses
348/// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.
349pub type Responses = BTreeMap<String, RefOrObject<Response>>;
350
351/// ### Reponse
352/// Describes a single response from an API Operation, including design-time, static links to operations based on the response.
353#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
354pub struct Response {
355    /// A short description of the response.
356    pub description: String,
357    /// Maps a header name to its definition.
358    #[serde(skip_serializing_if = "Option::is_none")]
359    pub headers: Option<BTreeMap<String, RefOrObject<Header>>>,
360    /// A map containing descriptions of potential response payloads.
361    #[serde(skip_serializing_if = "Option::is_none")]
362    pub content: Option<BTreeMap<String, Media>>,
363    /// A map of operations links that can be followed from the response.
364    #[serde(skip_serializing_if = "Option::is_none")]
365    pub links: Option<BTreeMap<String, RefOrObject<Link>>>,
366
367    #[serde(flatten)]
368    pub extensions: Extensions,
369}
370
371/// ### Media
372/// Each Media Type Object provides schema and examples for the media type identified by its key.
373#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
374pub struct Media {
375    /// The schema defining the content of the request, response, or parameter.
376    #[serde(skip_serializing_if = "Option::is_none")]
377    pub schema: Option<RefOrObject<Schema>>,
378    /// Example of the media type.
379    #[serde(skip_serializing_if = "Option::is_none")]
380    pub example: Option<Value>,
381    /// Examples of the media type.
382    #[serde(skip_serializing_if = "Option::is_none")]
383    pub examples: Option<BTreeMap<String, RefOrObject<Example>>>,
384    /// A map between a property name and its encoding information.
385    #[serde(skip_serializing_if = "Option::is_none")]
386    pub encoding: Option<BTreeMap<String, Encoding>>,
387}
388
389/// ### Encoding
390/// A single encoding definition applied to a single schema property.
391#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
392pub struct Encoding {
393    /// The Content-Type for encoding a specific property.
394    #[serde(skip_serializing_if = "Option::is_none")]
395    #[serde(rename = "contentType")]
396    pub content_type: Option<String>,
397    /// A map allowing additional information to be provided as headers.
398    #[serde(skip_serializing_if = "Option::is_none")]
399    pub headers: Option<BTreeMap<String, RefOrObject<Header>>>,
400    /// Describes how a specific property value will be serialized depending on its type.
401    #[serde(skip_serializing_if = "Option::is_none")]
402    pub style: Option<String>,
403    /// 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.
404    #[serde(skip_serializing_if = "Option::is_none")]
405    pub explode: Option<bool>,
406    /// Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without percent-encoding.
407    #[serde(skip_serializing_if = "Option::is_none")]
408    #[serde(rename = "allowReserved")]
409    pub allow_reserved: Option<bool>,
410}
411
412/// ### Callback
413/// A map of possible out-of band callbacks related to the parent operation.
414pub type Callback = BTreeMap<String, PathItem>;
415
416/// ### Example
417#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
418pub struct Example {
419    /// Short description for the example.
420    #[serde(skip_serializing_if = "Option::is_none")]
421    pub summary: Option<String>,
422    /// Long description for the example.
423    #[serde(skip_serializing_if = "Option::is_none")]
424    pub description: Option<String>,
425    /// Embedded literal example.
426    #[serde(skip_serializing_if = "Option::is_none")]
427    pub value: Option<Value>,
428    /// A URL that points to the literal example.
429    #[serde(skip_serializing_if = "Option::is_none", rename = "externalValue")]
430    pub external_value: Option<String>,
431}
432
433/// ### Link
434/// The Link object represents a possible design-time link for a response.
435#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
436pub struct Link {
437    /// A relative or absolute URI reference to an OAS operation.
438    #[serde(skip_serializing_if = "Option::is_none", rename = "operationRef")]
439    pub operation_ref: Option<String>,
440    /// The name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
441    #[serde(skip_serializing_if = "Option::is_none", rename = "operationId")]
442    pub operation_id: Option<String>,
443    /// A map representing parameters to pass to an operation as specified with operationId or identified via operationRef.
444    #[serde(skip_serializing_if = "Option::is_none")]
445    pub parameters: Option<BTreeMap<String, Value>>,
446    /// A literal value or {expression} to use as a request body when calling the target operation.
447    #[serde(skip_serializing_if = "Option::is_none", rename = "requestBody")]
448    pub request_body: Option<Value>,
449    /// A description of the link.
450    #[serde(skip_serializing_if = "Option::is_none")]
451    pub description: Option<String>,
452    /// A server object to be used by the target operation.
453    #[serde(skip_serializing_if = "Option::is_none")]
454    pub server: Option<Server>,
455}
456/// ### Header
457/// The Header Object follows the structure of the Parameter Object with the following changes
458/// see https://swagger.io/specification/v3/#header-object
459#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
460pub struct Header {
461    /// A brief description of the parameter.
462    #[serde(skip_serializing_if = "Option::is_none")]
463    pub description: Option<String>,
464    /// Determines whether this parameter is mandatory.
465    #[serde(skip_serializing_if = "Option::is_none")]
466    pub required: Option<bool>,
467    /// Specifies that a parameter is deprecated and SHOULD be transitioned out of usage.
468    #[serde(skip_serializing_if = "Option::is_none")]
469    pub deprecated: Option<bool>,
470    /// Sets the ability to pass empty-valued parameters.
471    #[serde(skip_serializing_if = "Option::is_none", rename = "allowEmptyValue")]
472    pub allow_empty_value: Option<bool>,
473
474    ///Describes how the parameter value will be serialized depending on the type of the parameter value.
475    #[serde(skip_serializing_if = "Option::is_none")]
476    pub style: Option<String>,
477    /// 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.
478    #[serde(skip_serializing_if = "Option::is_none")]
479    pub explode: Option<bool>,
480
481    /// Determines whether the parameter value SHOULD allow reserved characters
482    #[serde(skip_serializing_if = "Option::is_none", rename = "allowReserved")]
483    pub allow_reserved: Option<bool>,
484
485    /// The schema defining the type used for the parameter.
486    #[serde(skip_serializing_if = "Option::is_none")]
487    pub schema: Option<RefOrObject<Schema>>,
488    /// Example of the parameter's potential value.
489    #[serde(skip_serializing_if = "Option::is_none")]
490    pub example: Option<Value>,
491    /// Examples of the parameter's potential value.
492    #[serde(skip_serializing_if = "Option::is_none")]
493    pub examples: Option<BTreeMap<String, RefOrObject<Example>>>,
494    /// A map containing the representations for the parameter.
495    #[serde(skip_serializing_if = "Option::is_none")]
496    pub content: Option<BTreeMap<String, Media>>,
497
498    #[serde(flatten)]
499    pub extensions: Extensions,
500}
501/// ## Tag
502/// Adds metadata to a single tag that is used by the Operation Object.
503#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
504pub struct Tag {
505    /// The name of the tag.
506    pub name: String,
507    /// A short description for the tag.
508    #[serde(skip_serializing_if = "Option::is_none")]
509    pub description: Option<String>,
510    /// Additional external documentation for this tag.
511    #[serde(skip_serializing_if = "Option::is_none", rename = "externalDocs")]
512    pub external_docs: Option<ExternalDoc>,
513
514    #[serde(flatten)]
515    pub extensions: Extensions,
516}
517
518/// ### Reference
519/// A simple object to allow referencing other components in the specification, internally and externally.
520#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
521pub struct Reference {
522    /// The reference string.
523    #[serde(rename = "$ref")]
524    pub reference: String,
525}
526
527/// ### Schema
528/// The Schema Object allows the definition of input and output data types.
529/// ser https://swagger.io/specification/v3/#schema-object
530#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
531pub struct Schema {
532    #[serde(skip_serializing_if = "Option::is_none")]
533    pub title: Option<String>,
534    #[serde(skip_serializing_if = "Option::is_none")]
535    #[serde(rename = "enum")]
536    pub r#enum: Option<Vec<String>>,
537    #[serde(skip_serializing_if = "Option::is_none", rename = "multipleOf")]
538    pub multiple_of: Option<Number>,
539    #[serde(skip_serializing_if = "Option::is_none")]
540    pub maximum: Option<Number>,
541    #[serde(skip_serializing_if = "Option::is_none", rename = "exclusiveMaximum")]
542    pub exclusive_maximum: Option<bool>,
543    #[serde(skip_serializing_if = "Option::is_none")]
544    pub minimum: Option<Number>,
545    #[serde(skip_serializing_if = "Option::is_none", rename = "exclusiveMinimum")]
546    pub exclusive_minimum: Option<bool>,
547    #[serde(skip_serializing_if = "Option::is_none", rename = "maxLength")]
548    pub max_length: Option<Number>,
549    #[serde(skip_serializing_if = "Option::is_none", rename = "minLength")]
550    pub min_length: Option<Number>,
551    #[serde(skip_serializing_if = "Option::is_none")]
552    pub pattern: Option<String>,
553    #[serde(skip_serializing_if = "Option::is_none", rename = "maxItems")]
554    pub max_items: Option<Number>,
555    #[serde(skip_serializing_if = "Option::is_none", rename = "minItems")]
556    pub min_items: Option<Number>,
557    #[serde(skip_serializing_if = "Option::is_none", rename = "uniqueItems")]
558    pub unique_items: Option<bool>,
559    #[serde(skip_serializing_if = "Option::is_none")]
560    pub items: Option<Box<RefOrObject<Schema>>>,
561    #[serde(skip_serializing_if = "Option::is_none")]
562    pub properties: Option<BTreeMap<String, RefOrObject<Schema>>>,
563    #[serde(skip_serializing_if = "Option::is_none", rename = "maxProperties")]
564    pub max_properties: Option<Number>,
565    #[serde(skip_serializing_if = "Option::is_none", rename = "minProperties")]
566    pub min_properties: Option<Number>,
567    #[serde(skip_serializing_if = "Option::is_none")]
568    pub required: Option<Vec<String>>,
569    #[serde(skip_serializing_if = "Option::is_none")]
570    #[serde(rename = "type")]
571    pub r#type: Option<String>,
572    #[serde(skip_serializing_if = "Option::is_none", rename = "allOf")]
573    pub all_of: Option<Vec<Box<RefOrObject<Schema>>>>,
574    #[serde(skip_serializing_if = "Option::is_none", rename = "oneOf")]
575    pub one_of: Option<Vec<Box<RefOrObject<Schema>>>>,
576    #[serde(skip_serializing_if = "Option::is_none", rename = "anyOf")]
577    pub any_of: Option<Vec<Box<RefOrObject<Schema>>>>,
578    #[serde(skip_serializing_if = "Option::is_none")]
579    pub not: Option<Box<RefOrObject<Schema>>>,
580    #[serde(skip_serializing_if = "Option::is_none")]
581    pub description: Option<String>,
582    #[serde(skip_serializing_if = "Option::is_none")]
583    pub format: Option<String>,
584    #[serde(skip_serializing_if = "Option::is_none")]
585    pub default: Option<String>,
586    #[serde(
587        skip_serializing_if = "Option::is_none",
588        rename = "additionalProperties"
589    )]
590    pub additional_properties: Option<Value>,
591
592    #[serde(skip_serializing_if = "Option::is_none")]
593    pub nullable: Option<bool>,
594    /// Adds support for polymorphism.
595    #[serde(skip_serializing_if = "Option::is_none")]
596    pub discriminator: Option<Discriminator>,
597    /// Relevant only for Schema "properties" definitions.
598    #[serde(skip_serializing_if = "Option::is_none", rename = "readOnly")]
599    pub read_only: Option<bool>,
600    /// Relevant only for Schema "properties" definitions.
601    #[serde(skip_serializing_if = "Option::is_none", rename = "writeOnly")]
602    pub write_only: Option<bool>,
603    /// This MAY be used only on properties schemas.
604    #[serde(skip_serializing_if = "Option::is_none")]
605    pub xml: Option<XML>,
606    /// Additional external documentation for this schema.
607    #[serde(skip_serializing_if = "Option::is_none", rename = "externalDocs")]
608    pub external_docs: Option<ExternalDoc>,
609    /// A free-form property to include an example of an instance for this schema.
610    #[serde(skip_serializing_if = "Option::is_none")]
611    pub example: Option<Value>,
612    /// Specifies that a schema is deprecated and SHOULD be transitioned out of usage.
613    #[serde(skip_serializing_if = "Option::is_none")]
614    pub deprecated: Option<bool>,
615}
616
617/// ### Discriminator
618/// When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation.
619#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
620pub struct Discriminator {
621    /// The name of the property in the payload that will hold the discriminator value.
622    #[serde(rename = "propertyName")]
623    pub property_name: String,
624    /// An object to hold mappings between payload values and schema names or references.
625    #[serde(skip_serializing_if = "Option::is_none")]
626    pub mapping: Option<BTreeMap<String, String>>,
627}
628
629/// ### XML
630/// A metadata object that allows for more fine-tuned XML model definitions.
631#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
632pub struct XML {
633    /// Replaces the name of the element/attribute used for the described schema property.
634    #[serde(skip_serializing_if = "Option::is_none")]
635    pub name: Option<String>,
636    /// The URI of the namespace definition.
637    #[serde(skip_serializing_if = "Option::is_none")]
638    pub namespace: Option<String>,
639    /// The prefix to be used for the name.
640    #[serde(skip_serializing_if = "Option::is_none")]
641    pub prefix: Option<String>,
642    /// Declares whether the property definition translates to an attribute instead of an element.
643    #[serde(skip_serializing_if = "Option::is_none")]
644    pub attribute: Option<bool>,
645    /// MAY be used only for an array definition.
646    #[serde(skip_serializing_if = "Option::is_none")]
647    pub wrapped: Option<bool>,
648}
649
650/// ### SecurityScheme
651/// Defines a security scheme that can be used by the operations.
652#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
653pub struct SecurityScheme {
654    ///  The type of the security scheme.
655    pub r#type: SecuritySchemeType,
656    /// A short description for security scheme.
657    #[serde(skip_serializing_if = "Option::is_none")]
658    pub description: Option<String>,
659    /// The name of the header, query or cookie parameter to be used.
660    pub name: String,
661    /// The location of the API key. Valid values are "query", "header" or "cookie".
662    pub r#in: String,
663    /// The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1).
664    pub scheme: String,
665    /// A hint to the client to identify how the bearer token is formatted.
666    #[serde(skip_serializing_if = "Option::is_none", rename = "beareFormat")]
667    pub beare_format: Option<String>,
668    ///  An object containing configuration information for the flow types supported.
669    pub flows: OAuthFlows,
670    ///  OpenId Connect URL to discover OAuth2 configuration values.
671    #[serde(rename = "openIdConnectUrl")]
672    pub open_id_connect_url: String,
673}
674
675/// #### SecuritySchemeType
676/// for SecurityScheme.type
677#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
678#[serde(rename_all = "camelCase")]
679pub enum SecuritySchemeType {
680    ApiKey,
681    Http,
682    Oauth2,
683    OpenIdConnect,
684}
685
686/// ### OAuthFlows
687///
688/// Allows configuration of the supported OAuth Flows.
689#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
690pub struct OAuthFlows {
691    /// Configuration for the OAuth Implicit flow
692    #[serde(skip_serializing_if = "Option::is_none")]
693    pub implicit: Option<OAuthFlow>,
694    /// Configuration for the OAuth Resource Owner Password flow
695    #[serde(skip_serializing_if = "Option::is_none")]
696    pub password: Option<OAuthFlow>,
697    /// Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
698    #[serde(skip_serializing_if = "Option::is_none", rename = "clientCredentials")]
699    pub client_credentials: Option<OAuthFlow>,
700    /// Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
701    #[serde(skip_serializing_if = "Option::is_none", rename = "authorizationCode")]
702    pub authorization_code: Option<OAuthFlow>,
703}
704
705/// ### OAuthFlow
706/// Configuration details for a supported OAuth Flow
707#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
708pub struct OAuthFlow {
709    /// The authorization URL to be used for this flow.
710    #[serde(rename = "authorizationUrl")]
711    pub authorization_url: String,
712    /// The token URL to be used for this flow.
713    #[serde(rename = "tokenUrl")]
714    pub token_url: String,
715    /// The URL to be used for obtaining refresh tokens.
716    #[serde(rename = "refreshUrl", skip_serializing_if = "Option::is_none")]
717    pub refresh_url: Option<String>,
718    /// The available scopes for the OAuth2 security scheme.
719    pub scopes: BTreeMap<String, String>,
720}
721
722/// ### SecurityRequirement
723/// Lists the required security schemes to execute this operation.
724pub type SecurityRequirement = BTreeMap<String, Vec<String>>;
725
726#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
727#[serde(untagged)]
728pub enum RefOrObject<T> {
729    Ref(Reference),
730    Object(T),
731}