1 /**
2  * Data structures needed to parse and document an OpenAPI Specification.
3  *
4  * See_Also:
5  *   https://spec.openapis.org/oas/latest.html
6  *   https://swagger.io/specification/
7  */
8 module openapi;
9 
10 import vibe.data.json : Json;
11 import vibe.data.serialization : jsonName = name, jsonOptional = optional;
12 
13 /**
14  * The root document of an OpenAPI Specification.
15  *
16  * The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs
17  * which allows both humans and computers to discover and understand the capabilities of the service
18  * without access to source code, documentation, or through network traffic inspection. When
19  * properly defined, a consumer can understand and interact with the remote service with a minimal
20  * amount of implementation logic.
21  *
22  * An OpenAPI definition can then be used by documentation generation tools to display the API, code
23  * generation tools to generate servers and clients in various programming languages, testing
24  * tools, and many other use cases.
25  *
26  * See: https://swagger.io/specification/
27  */
28 class OasDocument {
29   /**
30    * The semantic version number of the OpenAPI Specification.
31    *
32    * **REQUIRED**. This string MUST be the semantic version number of the OpenAPI Specification
33    * version that the OpenAPI document uses. The openapi field SHOULD be used by tooling
34    * specifications and clients to interpret the OpenAPI document. This is not related to the API
35    * info.version string.
36    */
37   string openapi;
38 
39   OasInfo info;
40 
41   @jsonOptional
42   OasServer[] servers;
43 
44   /**
45    * **REQUIRED**. The available paths and operations for the API.
46    *
47    * The key is a relative path to an individual endpoint. The key MUST begin with a forward slash
48    * (/). The path is appended (no relative URL resolution) to the expanded URL from the [OasServer]
49    * object's url field in order to construct the full URL. Path templating is allowed. When
50    * matching URLs, concrete (non-templated) paths would be matched before their templated
51    * counterparts. Templated paths with the same hierarchy but different templated names MUST NOT
52    * exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide
53    * which one to use.
54    */
55   OasPathItem[string] paths;
56 
57   /**
58    * An element to hold various schemas for the specification.
59    */
60   @jsonOptional
61   OasComponents components;
62 
63   /**
64    * A list of named [securitySchemes] that can be used to access this API.
65    *
66    * A declaration of which security mechanisms can be used across the API. The list of values
67    * includes alternative security requirement objects that can be used. Only one of the security
68    * requirement objects need to be satisfied to authorize a request. Individual operations can
69    * override this definition. To make security optional, an empty security requirement ({}) can be
70    * included in the array.
71    */
72   @jsonOptional
73   OasSecurityRequirement[] security;
74 
75   /**
76    * A list of tags used by the specification with additional metadata. The order of the tags can be
77    * used to reflect on their order by the parsing tools. Not all tags that are used by the
78    * [OasOperation] object must be declared. The tags that are not declared MAY be organized
79    * randomly or based on the tools' logic. Each tag name in the list MUST be unique.
80    */
81   @jsonOptional
82   OasTag[] tags;
83 
84   /**
85    * Additional external documentation.
86    */
87   @jsonOptional
88   OasExternalDocumentation externalDocs;
89 }
90 
91 /**
92  * The object provides metadata about the API. The metadata MAY be used by the clients if needed,
93  * and MAY be presented in editing or documentation generation tools for convenience.
94  *
95  * See_Also: https://swagger.io/specification/#info-object
96  */
97 class OasInfo {
98   /**
99    * **REQUIRED**. The title of the API.
100    */
101   string title;
102 
103   /**
104    * A short description of the API. [CommonMark syntax](https://spec.commonmark.org/) MAY be used
105    * for rich text representation.
106    */
107   @jsonOptional
108   string description;
109 
110   /**
111    * A URL to the Terms of Service for the API. MUST be in the format of a URL.
112    */
113   @jsonOptional
114   string termsOfService;
115 
116   /**
117    * The contact information for the exposed API.
118    */
119   @jsonOptional
120   OasContact contact;
121 
122   /**
123    * The license information for the exposed API.
124    */
125   @jsonOptional
126   OasLicense license;
127 
128   /**
129    * **REQUIRED**. The version of the OpenAPI document (which is distinct from the [OpenAPI
130    * Specification version](https://swagger.io/specification/#oas-version) or the API implementation
131    * version).
132    */
133   string version_;
134 }
135 
136 /**
137  * Contact information for the exposed API.
138  *
139  * See_Also: https://swagger.io/specification/#contact-object
140  */
141 class OasContact {
142   /**
143    * The identifying name of the contact person/organization.
144    */
145   @jsonOptional
146   string name;
147 
148   /**
149    * The URL pointing to the contact information. MUST be in the format of a URL.
150    */
151   @jsonOptional
152   string url;
153 
154   /**
155    * The email address of the contact person/organization. MUST be in the format of an email
156    * address.
157    */
158   @jsonOptional
159   string email;
160 }
161 
162 /**
163  * License information for the exposed API.
164  *
165  * See_Also: https://swagger.io/specification/#license-object
166  */
167 class OasLicense {
168   /**
169    * **REQUIRED**. The license name used for the API.
170    */
171   string name;
172 
173   /**
174    * A URL to the license used for the API. MUST be in the format of a URL.
175    */
176   @jsonOptional
177   string url;
178 }
179 
180 /**
181  * An object representing a Server.
182  *
183  * See_Also: https://swagger.io/specification/#server-object
184  */
185 class OasServer {
186   /**
187    * **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative,
188    * to indicate that the host location is relative to the location where the OpenAPI document is
189    * being served. Variable substitutions will be made when a variable is named in {brackets}.
190    */
191   string url;
192 
193   /**
194    * An optional string describing the host designated by the URL. [CommonMark
195    * syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
196    */
197   @jsonOptional
198   string description;
199 
200   /**
201    * A map between a variable name and its value. The value is used for substitution in the server's
202    * URL template.
203    */
204   @jsonOptional
205   OasServerVariable[string] variables;
206 }
207 
208 /**
209  * An object representing a Server Variable for server URL template substitution.
210  *
211  * See_Also: https://swagger.io/specification/#server-variable-object
212  */
213 class OasServerVariable {
214   /**
215    * An enumeration of string values to be used if the substitution options are from a limited
216    * set. The array SHOULD NOT be empty.
217    */
218   string[] enum_;
219 
220   /**
221    * **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate
222    * value is not supplied. Note this behavior is different than the [OasSchema] object's treatment
223    * of default values, because in those cases parameter values are optional. If the enum is
224    * defined, the value SHOULD exist in the enum's values.
225    */
226   string default_;
227 
228   /**
229    * An optional description for the server variable. CommonMark syntax MAY be used for rich text
230    * representation.
231    */
232   @jsonOptional
233   string description;
234 }
235 
236 /**
237  * Describes the operations available on a single path. A Path Item MAY be empty, due to [ACL
238  * constraints](https://swagger.io/specification/#security-filtering). The path itself is still
239  * exposed to the documentation viewer but they will not know which operations and parameters are
240  * available.
241  *
242  * See_Also: https://swagger.io/specification/#path-item-object
243  */
244 class OasPathItem {
245   /**
246    * Allows for an external definition of this path item. The referenced structure MUST be in the
247    * format of a [OasPathItem] object. In case a [OasPathItem] field appears both in the defined
248    * object and the referenced object, the behavior is undefined.
249    */
250   @jsonName("$ref")
251   @jsonOptional
252   string ref_;
253 
254   /**
255    * An optional, string summary, intended to apply to all operations in this path.
256    */
257   @jsonOptional
258   string summary;
259 
260   /**
261    * An optional, string description, intended to apply to all operations in this path. [CommonMark
262    * syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
263    */
264   @jsonOptional
265   string description;
266 
267   /**
268    * A definition of a GET operation on this path.
269    */
270   @jsonOptional
271   OasOperation get;
272 
273   /**
274    * A definition of a PUT operation on this path.
275    */
276   @jsonOptional
277   OasOperation put;
278 
279   /**
280    * A definition of a POST operation on this path.
281    */
282   @jsonOptional
283   OasOperation post;
284 
285   /**
286    * A definition of a DELETE operation on this path.
287    */
288   @jsonOptional
289   OasOperation delete_;
290 
291   /**
292    * A definition of a OPTIONS operation on this path.
293    */
294   @jsonOptional
295   OasOperation options;
296 
297   /**
298    * A definition of a HEAD operation on this path.
299    */
300   @jsonOptional
301   OasOperation head;
302 
303   /**
304    * A definition of a PATCH operation on this path.
305    */
306   @jsonOptional
307   OasOperation patch;
308 
309   /**
310    * A definition of a TRACE operation on this path.
311    */
312   @jsonOptional
313   OasOperation trace;
314 
315   /**
316    * An alternative server array to service all operations in this path.
317    */
318   @jsonOptional
319   OasServer[] servers;
320 
321   /**
322    * A list of parameters that are applicable for all the operations described under this
323    * path. These parameters can be overridden at the operation level, but cannot be removed
324    * there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a
325    * combination of a name and location. The list can use the [OasReference] object to link to
326    * parameters that are defined at the [OasDocument] object's
327    * [components/parameters](https://swagger.io/specification/#components-parameters).
328    */
329   @jsonOptional
330   OasParameter[] parameters;
331 }
332 
333 /**
334  * Describes a single operation parameter.
335  *
336  * A unique parameter is defined by a combination of a name and location.
337  *
338  * # Parameter Locations
339  *
340  * There are four possible parameter locations specified by the in field:
341  * - path - Used together with Path Templating, where the parameter value is actually part of the
342  *   operation's URL. This does not include the host or base path of the API. For example, in
343  *   /items/{itemId}, the path parameter is itemId.
344  * - query - Parameters that are appended to the URL. For example, in /items?id=###, the query
345  *   parameter is id.
346  * - header - Custom headers that are expected as part of the request. Note that RFC7230 states
347  *   header names are case insensitive.
348  * - cookie - Used to pass a specific cookie value to the API.
349  *
350  * See_Also: https://swagger.io/specification/#parameter-object
351  */
352 class OasParameter {
353   /**
354    * A link to parameters defined in the [OasDocument's] components/parameters.
355    */
356   @jsonName("$ref")
357   @jsonOptional
358   string ref_;
359 
360   /**
361    * **REQUIRED**. The name of the parameter. Parameter names are case sensitive.
362    * - If in is "path", the name field MUST correspond to a template expression occurring within the
363    *   path field in the [OasPaths] object. See Path Templating for further information.
364    * - If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the
365    *   parameter definition SHALL be ignored.
366    * - For all other cases, the name corresponds to the parameter name used by the in property.
367    */
368   @jsonOptional
369   string name;
370 
371   /**
372    * **REQUIRED**. The location of the parameter. Possible values are "query", "header", "path" or
373    * "cookie".
374    */
375   @jsonOptional
376   string in_;
377 
378   /**
379    * A brief description of the parameter. This could contain examples of use. [CommonMark
380    * syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
381    */
382   @jsonOptional
383   string description;
384 
385   /**
386    * Determines whether this parameter is mandatory. If the parameter location is "path", this
387    * property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and
388    * its default value is false.
389    */
390   @jsonOptional
391   bool required = false;
392 
393   /**
394    * Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value
395    * is `false`.
396    */
397   @jsonOptional
398   bool deprecated_ = false;
399 
400   /**
401    * Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and
402    * allows sending a parameter with an empty value. Default value is `false`. If style is used, and
403    * if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. Use
404    * of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
405    */
406   @jsonOptional
407   bool allowEmptyValue = false;
408 
409   // The rules for serialization of the parameter are specified in one of two ways. For simpler
410   // scenarios, a schema and style can describe the structure and syntax of the parameter.
411 
412   /**
413    * Describes how the parameter value will be serialized depending on the type of the parameter
414    * value. Default values (based on value of in): for query - form; for path - simple; for header -
415    * simple; for cookie - form.
416    */
417   @jsonOptional
418   string style;
419 
420   /**
421    * When this is true, parameter values of type `array` or `object` generate separate parameters
422    * for each value of the array or key-value pair of the map. For other types of parameters this
423    * property has no effect. When [style] is `form`, the default value is `true`. For all other
424    * styles, the default value is `false`.
425    */
426   @jsonOptional
427   bool explode;
428 
429   /**
430    * Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986
431    * `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to
432    * parameters with an `in` value of `query`. The default value is `false`.
433    */
434   @jsonOptional
435   bool allowReserved;
436 
437   /**
438    * The schema defining the type used for the parameter.
439    */
440   @jsonOptional
441   OasSchema schema;
442 }
443 
444 /**
445  * Holds a set of reusable objects for different aspects of the OAS. All objects defined within the
446  * components object will have no effect on the API unless they are explicitly referenced from
447  * properties outside the components object.
448  */
449 class OasComponents {
450   /**
451    * An object to hold reusable [OasSchema] objects.
452    */
453   @jsonOptional
454   OasSchema[string] schemas; // |Ref
455 
456   /**
457    * An object to hold reusable [OasResponse] objects.
458    */
459   @jsonOptional
460   OasResponse[string] responses; // |Ref
461 
462   /**
463    * An object to hold reusable [OasParameter] objects.
464    */
465   @jsonOptional
466   OasParameter[string] parameters; // |Ref
467 
468   /**
469    * An object to hold reusable [OasExample] objects.
470    */
471   @jsonOptional
472   OasExample[string] examples; // |Ref
473 
474   /**
475    * An object to hold reusable [OasRequestBody] objects.
476    */
477   @jsonOptional
478   OasRequestBody[string] requestBodies; // |Ref
479 
480   /**
481    * An object to hold reusable [OasHeader] objects.
482    */
483   @jsonOptional
484   OasHeader[string] headers; // |Ref
485 
486   /**
487    * An object to hold reusable [OasSecurityScheme] objects.
488    */
489   @jsonOptional
490   OasSecurityScheme[string] securitySchemes; // |Ref
491 
492   /**
493    * An object to hold reusable [OasLink] objects.
494    */
495   @jsonOptional
496   OasLink[string] links; // |Ref
497 
498   /**
499    * An object to hold reusable [OasCallback] objects.
500    */
501   @jsonOptional
502   OasCallback[string] callbacks; // |Ref
503 }
504 
505 /**
506  * The [OasSchema] object allows the definition of input and output data types. These types can be
507  * objects, but also primitives and arrays. This object is an extended subset of the [JSON Schema
508  * Specification Wright Draft 00](https://json-schema.org/).
509  *
510  * For more information about the properties, see [JSON Schema
511  * Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema
512  * Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). Unless stated
513  * otherwise, the property definitions follow the JSON Schema.
514  *
515  * # Properties
516  *
517  * The following properties are taken directly from the JSON Schema definition and follow the same
518  * specifications:
519  * - title
520  * - multipleOf
521  * - maximum
522  * - exclusiveMaximum
523  * - minimum
524  * - exclusiveMinimum
525  * - maxLength
526  * - minLength
527  * - pattern (This string SHOULD be a valid regular expression, according to the Ecma-262 Edition
528      5.1 regular expression dialect)
529  * - maxItems
530  * - minItems
531  * - uniqueItems
532  * - maxProperties
533  * - minProperties
534  * - required
535  * - enum
536  *
537  * The following properties are taken from the JSON Schema definition but their definitions were
538  * adjusted to the OpenAPI Specification:
539  *
540  * - type - Value MUST be a string. Multiple types via an array are not supported.
541  * - allOf - Inline or referenced schema MUST be of a [OasSchema] object and not a standard
542  *   JSON Schema.
543  * - oneOf - Inline or referenced schema MUST be of a [OasSchema] object and not a standard
544  *   JSON Schema.
545  * - anyOf - Inline or referenced schema MUST be of a [OasSchema] object and not a standard
546  *   JSON Schema.
547  * - not - Inline or referenced schema MUST be of a [OasSchema] object and not a standard
548  *   JSON Schema.
549  * - items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a
550  *   [OasSchema] object and not a standard JSON Schema. items MUST be present if the type is array.
551  * - properties - Property definitions MUST be a [OasSchema] object and not a standard JSON Schema
552  *   (inline or referenced).
553  * - additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a
554  *   [OasSchema] object and not a standard JSON Schema. Consistent with JSON Schema,
555  *   additionalProperties defaults to true.
556  * - description - CommonMark syntax MAY be used for rich text representation.
557  * - format - See Data Type Formats for further details. While relying on JSON Schema's defined
558  *   formats, the OAS offers a few additional predefined formats.
559  * - default - The default value represents what would be assumed by the consumer of the input as
560  *   the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to
561  *   the defined type for the [OasSchema] object defined at the same level. For example, if type is
562  *   string, then default can be "foo" but cannot be 1.
563  *
564  * Alternatively, any time a [OasSchema] object can be used, a [OasReference] object can be used in
565  * its place. This allows referencing definitions instead of defining them inline.
566  *
567  * Additional properties defined by the JSON Schema specification that are not mentioned here are
568  * strictly unsupported.
569  *
570  * Other than the JSON Schema subset fields, the following fields MAY be used for further schema
571  * documentation:
572  */
573 class OasSchema {
574   /**
575    * An internal or external reference to a schema component. If set, the other attribute are
576    * unused.
577    */
578   @jsonName("$ref")
579   @jsonOptional
580   string ref_;
581 
582   /**
583    * Both of these keywords can be used to decorate a user interface with information about the data
584    * produced by this user interface.  A title will preferrably be short, whereas a description will
585    * provide explanation about the purpose of the instance described by this schema.
586    *
587    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-6.1
588    */
589   @jsonOptional
590   string title;
591 
592   /**
593    * Both of these keywords can be used to decorate a user interface with information about the data
594    * produced by this user interface.  A title will preferrably be short, whereas a description will
595    * provide explanation about the purpose of the instance described by this schema.
596    *
597    * CommonMark syntax MAY be used for rich text representation.
598    *
599    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-6.1
600    */
601   @jsonOptional
602   string description;
603 
604   /**
605    * Value MUST be a string. Multiple types via an array are not supported.
606    *
607    * One of seven primitive types from the core specification:
608    * - null
609    * - boolean
610    * - object
611    * - array
612    * - number
613    * - string
614    *
615    * See_Also:
616    *   https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.21
617    *   https://datatracker.ietf.org/doc/html/draft-wright-json-schema-00#section-4.2
618    */
619   @jsonOptional
620   string type;
621 
622   /**
623    * Structural validation alone may be insufficient to validate that an instance meets all the
624    * requirements of an application.  The "format" keyword is defined to allow interoperable
625    * semantic validation for a fixed subset of values which are accurately described by
626    * authoritative resources, be they RFCs or other external specifications.
627    *
628    * The value of this keyword is called a format attribute.  It MUST be a string.  A format
629    * attribute can generally only validate a given set of instance types.  If the type of the
630    * instance to validate is not in this set, validation for this format attribute and instance
631    * SHOULD succeed.
632    *
633    * See [Data Type Formats](https://swagger.io/specification/#data-type-format) for further
634    * details. While relying on JSON Schema's defined formats, the OAS offers a few additional
635    * predefined formats.
636    *
637    * Example values when "type" is "integer" include: "int32", "int64".
638    * Example values when "type" is "number" include: "float", "double".
639    * Example values when "type" is "string" include: "date", "date-time", "password".
640    *
641    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-7
642    */
643   @jsonOptional
644   string format;
645 
646   /**
647    * This keyword's value MUST be an array.  This array MUST have at least one element.
648    *
649    * Elements of the array MUST be objects.  Each object MUST be a valid JSON Schema.
650    *
651    * An instance validates successfully against this keyword if it validates successfully against
652    * all schemas defined by this keyword's value.
653    *
654    * Inline or referenced schema MUST be of a [OasSchema] object and not a standard JSON Schema.
655    *
656    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.22
657    */
658   @jsonOptional
659   OasSchema[] allOf;
660 
661   /**
662    * This keyword's value MUST be an array. This array MUST have at least one element.
663    *
664    * Elements of the array MUST be objects. Each object MUST be a valid JSON Schema.
665    *
666    * An instance validates successfully against this keyword if it validates successfully against
667    * exactly one schema defined by this keyword's value.
668    *
669    * Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
670    *
671    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.24
672    */
673   @jsonOptional
674   OasSchema[] oneOf;
675 
676   /**
677    * This keyword's value MUST be an array.  This array MUST have at least one element.
678    *
679    * Elements of the array MUST be objects. Each object MUST be a valid JSON Schema.
680    *
681    * An instance validates successfully against this keyword if it validates successfully against at
682    * least one schema defined by this keyword's value.
683    *
684    * Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
685    *
686    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.23
687    */
688   @jsonOptional
689   OasSchema[] anyOf;
690 
691   /**
692    * This keyword's value MUST be an object.  This object MUST be a valid JSON Schema.
693    *
694    * An instance is valid against this keyword if it fails to validate successfully against the
695    * schema defined by this keyword.
696    *
697    * Inline or referenced schema MUST be of a [OasSchema] object and not a standard JSON Schema.
698    *
699    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.25
700    */
701   @jsonOptional
702   OasSchema not;
703 
704   /**
705    * If present, a schema that validates items of an array
706    *
707    * Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema
708    * Object and not a standard JSON Schema. items MUST be present if the type is array.
709    *
710    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.9
711    */
712   @jsonOptional
713   OasSchema items;
714 
715   /**
716    * An mapping from an object property name to a schemas that property must be validated against.
717    *
718    * The value of "properties" MUST be an object.  Each value of this object MUST be an object, and
719    * each object MUST be a valid JSON Schema.
720    *
721    * If absent, it can be considered the same as an empty object.
722    *
723    * Property definitions MUST be a [OasSchema] object and not a standard JSON Schema (inline or
724    * referenced).
725    *
726    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.16
727    */
728   @jsonOptional
729   OasSchema[string] properties;
730 
731   /**
732    * The value of "additionalProperties" MUST be a boolean or a schema.
733    *
734    * If "additionalProperties" is absent, it may be considered present with an empty schema as a
735    * value.
736    *
737    * If "additionalProperties" is true, validation always succeeds.
738    *
739    * If "additionalProperties" is false, validation succeeds only if the instance is an object and
740    * all properties on the instance were covered by "properties" and/or "patternProperties".
741    *
742    * If "additionalProperties" is an object, validate the value as a schema to all of the properties
743    * that weren't validated by "properties" nor "patternProperties".
744    *
745    * Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not
746    * a standard JSON Schema. Consistent with JSON Schema, additionalProperties defaults to true.
747    *
748    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.18
749    */
750   @jsonOptional
751   Json additionalProperties;
752 
753   /**
754    * The value of this keyword MUST be an array.  This array MUST have at least one element.
755    * Elements of this array MUST be strings, and MUST be unique.
756    *
757    * An object instance is valid against this keyword if its property set contains all elements in
758    * this keyword's array value.
759    *
760    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.15
761    */
762   @jsonOptional
763   string[] required;
764 
765   /**
766    * The value of this keyword MUST be an array.  This array SHOULD have at least one element.
767    * Elements in the array SHOULD be unique.
768    *
769    * Elements in the array MAY be of any type, including null.
770    *
771    * An instance validates successfully against this keyword if its value is equal to one of the
772    * elements in this keyword's array value.
773    *
774    * See_Also: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.20
775    */
776   @jsonOptional
777   Json[] enum_;
778 
779   // TODO: Support "default".
780 
781   /**
782    * A true value adds "null" to the allowed type specified by the type keyword, only if `type` is
783    * explicitly defined within the same [OasSchema] object. Other [OasSchema] object constraints
784    * retain their defined behavior, and therefore may disallow the use of `null` as a value. A
785    * `false` value leaves the specified or default `type` unmodified. The default value is `false`.
786    */
787   @jsonOptional
788   bool nullable = false;
789 
790   /**
791    * Adds support for polymorphism. The discriminator is an object name that is used to
792    * differentiate between other schemas which may satisfy the payload description. See Composition
793    * and Inheritance for more details.
794    */
795   @jsonOptional
796   OasDiscriminator discriminator;
797 
798   /**
799    * Relevant only for Schema "properties" definitions. Declares the property as "read only". This
800    * means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the
801    * request. If the property is marked as `readOnly` being `true` and is in the `required` list,
802    * the `required` will take effect on the response only. A property MUST NOT be marked as both
803    * `readOnly` and `writeOnly` being `true`. Default value is `false`.
804    */
805   @jsonOptional
806   bool readOnly = false;
807 
808   /**
809    * Relevant only for Schema "properties" definitions. Declares the property as "write
810    * only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the
811    * response. If the property is marked as `writeOnly` being `true` and is in the `required` list,
812    * the `required` will take effect on the request only. A property MUST NOT be marked as both
813    * `readOnly` and `writeOnly` being `true`. Default value is `false`.
814    */
815   @jsonOptional
816   bool writeOnly = false;
817 
818   // TODO:
819   // XML xml;
820 
821   // TODO:
822   // OasExternalDocs xml;
823 
824   // TODO:
825   // void* example;
826 
827   // TODO:
828   // bool deprecated;
829 }
830 
831 /**
832  * Describes a single response from an API Operation, including design-time, static links to
833  * operations based on the response.
834  *
835  * See_Also: https://swagger.io/specification/#response-object
836  */
837 class OasResponse {
838   /**
839    * An internal or external reference to a response component. If set, the other attribute are
840    * unused.
841    */
842   @jsonName("$ref")
843   @jsonOptional
844   string ref_;
845 
846   /**
847    * **REQUIRED**. A short description of the response. [CommonMark
848    * syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
849    */
850   @jsonOptional
851   string description;
852 
853   /**
854    * Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22)
855    * states header names are case insensitive. If a response header is defined with the name
856    * "Content-Type", it SHALL be ignored.
857    */
858   @jsonOptional
859   OasHeader[string] headers; // |Ref
860 
861   /**
862    * A map containing descriptions of potential response payloads. The key is a media type or [media
863    * type range](https://tools.ietf.org/html/rfc7231#appendix--d) and the value describes it. For
864    * responses that match multiple keys, only the most specific key is applicable. e.g. `text/plain`
865    * overrides `text/*`
866    */
867   @jsonOptional
868   OasMediaType[string] content;
869 
870   /**
871    * A map of operations links that can be followed from the response. The key of the map is a short
872    * name for the link, following the naming constraints of the names for [OasComponent] objects.
873    */
874   @jsonOptional
875   OasLink[string] links;
876 }
877 
878 /**
879  * Data about OasHeader. The OasHeader object follows the structure of the [OasParameter] object
880  * with the following changes:
881  *
882  * 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map.
883  * 2. in MUST NOT be specified, it is implicitly in `header`.
884  * 3. All traits that are affected by the location MUST be applicable to a location of `header` (for
885  *    example, style).
886  */
887 class OasHeader {
888   /**
889    * A link to parameters defined in the [OasDocument's] components/references.
890    */
891   @jsonName("$ref")
892   @jsonOptional
893   string ref_;
894 
895   /**
896    * A brief description of the header. This could contain examples of use. [CommonMark
897    * syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
898    */
899   @jsonOptional
900   string description;
901 
902   /**
903    * Determines whether this header is mandatory. If the parameter location is "path", this
904    * property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and
905    * its default value is `false`.
906    */
907   @jsonOptional
908   bool required = false;
909 
910   /**
911    * Specifies that a header is deprecated and SHOULD be transitioned out of usage. Default value
912    * is `false`.
913    */
914   @jsonOptional
915   bool deprecated_ = false;
916 
917   /**
918    * Sets the ability to pass empty-valued headers. This is valid only for headers and allows
919    * sending a header with an empty value. Default value is false. If style is used, and if behavior
920    * is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. Use of this
921    * property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
922    */
923   @jsonOptional
924   bool allowEmptyValue = false;
925 }
926 
927 /**
928  * Each OasMediaType object provides schema and examples for the media type identified by its key.
929  *
930  * See_Also: https://swagger.io/specification/#media-type-object
931  */
932 class OasMediaType {
933   /**
934    * The schema defining the content of the request, response, or parameter.
935    */
936   @jsonOptional
937   OasSchema schema;
938 
939   /**
940    * A map between a property name and its encoding information. The key, being the property name,
941    * MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody`
942    * objects when the media type is `multipart` or `application/x-www-form-urlencoded`.
943    */
944   @jsonOptional
945   OasEncoding[string] encoding;
946 }
947 
948 /**
949  * A single encoding definition applied to a single schema property.
950  */
951 class OasEncoding {
952   /**
953    * The Content-Type for encoding a specific property. Default value depends on the property type:
954    * for `string` with `format` being `binary` – `application/octet-stream`; for other primitive
955    * types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined
956    * based on the inner type. The value can be a specific media type (e.g. `application/json`), a
957    * wildcard media type (e.g. `image/*`), or a comma-separated list of the two types.
958    */
959   @jsonOptional
960   string contentType;
961 
962   /**
963    * A map allowing additional information to be provided as headers, for example
964    * `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this
965    * section. This property SHALL be ignored if the request body media type is not a `multipart`.
966    */
967   @jsonOptional
968   OasHeader[string] headers; // |Ref
969 
970   /**
971    * Describes how a specific property value will be serialized depending on its type. See
972    * [OasParameter] object for details on the [style] property. The behavior follows the same values
973    * as `query` parameters, including default values. This property SHALL be ignored if the request
974    * body media type is not `application/x-www-form-urlencoded`.
975    */
976   @jsonOptional
977   string style;
978 
979   /**
980    * When this is true, property values of type `array` or `object` generate separate parameters for
981    * each value of the array, or key-value-pair of the map. For other types of properties this
982    * property has no effect. When [style] is `form`, the default value is `true`. For all other
983    * styles, the default value is `false`. This property SHALL be ignored if the request body media
984    * type is not `application/x-www-form-urlencoded`.
985    */
986   @jsonOptional
987   bool explode;
988 
989   /**
990    * Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986
991    * `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is
992    * `false`. This property SHALL be ignored if the request body media type is not
993    * `application/x-www-form-urlencoded`.
994    */
995   @jsonOptional
996   bool allowReserved;
997 }
998 
999 /**
1000  * Lists the required security schemes to execute this operation. The name used for each property
1001  * MUST correspond to a security scheme declared in the Security Schemes under the Components
1002  * Object.
1003  *
1004  * Security Requirement Objects that contain multiple schemes require that all schemes MUST be
1005  * satisfied for a request to be authorized. This enables support for scenarios where multiple query
1006  * parameters or HTTP headers are required to convey security information.
1007  *
1008  * When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object,
1009  * only one of the Security Requirement Objects in the list needs to be satisfied to authorize the
1010  * request.
1011  *
1012  * See_Also: https://swagger.io/specification/#security-requirement-object
1013  */
1014 alias OasSecurityRequirement = string[][string];
1015 
1016 /**
1017  * Adds metadata to a single tag that is used by the [OasOperation] object. It is not mandatory to
1018  * have a Tag Object per tag defined in the Operation Object instances.
1019  *
1020  * See_Also: https://swagger.io/specification/#tag-object
1021  */
1022 class OasTag {
1023   /**
1024    * **REQUIRED**. The name of the tag.
1025    */
1026   string name;
1027 
1028   /**
1029    * A short description for the tag. [CommonMark syntax](https://spec.commonmark.org/) MAY be used
1030    * for rich text representation.
1031    */
1032   @jsonOptional
1033   string description;
1034 
1035   /**
1036    * Additional external documentation for this tag.
1037    */
1038   @jsonOptional
1039   OasExternalDocumentation externalDocs;
1040 }
1041 
1042 /**
1043  * Allows referencing an external resource for extended documentation.
1044  *
1045  * See_Also: https://swagger.io/specification/#external-documentation-object
1046  */
1047 class OasExternalDocumentation {
1048   /**
1049    * A short description of the target documentation. [CommonMark
1050    * syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
1051    */
1052   @jsonOptional
1053   string description;
1054 
1055   /**
1056    * **REQUIRED**. The URL for the target documentation. Value MUST be in the format of a URL.
1057    */
1058   string url;
1059 }
1060 
1061 /**
1062  * Describes a singel API operation on a path.
1063  */
1064 class OasOperation {
1065   /**
1066    * A list of tags for API documentation control. Tags can be used for logical grouping of
1067    * operations by resources or any other qualifier.
1068    */
1069   @jsonOptional
1070   string[] tags;
1071 
1072   /**
1073    * A short summary of what the operation does.
1074    */
1075   @jsonOptional
1076   string summary;
1077 
1078   /**
1079    * A verbose explanation of the operation behavior. [CommonMark
1080    * syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
1081    */
1082   @jsonOptional
1083   string description;
1084 
1085   /**
1086    * Additional external documentation for this operation.
1087    */
1088   @jsonOptional
1089   OasExternalDocumentation externalDocs;
1090 
1091   /**
1092    * Unique string used to identify the operation. The id MUST be unique among all operations
1093    * described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use
1094    * the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow
1095    * common programming naming conventions.
1096    */
1097   @jsonOptional
1098   string operationId;
1099 
1100   /**
1101    * A list of parameters that are applicable for this operation. If a parameter is already defined
1102    * at the Path Item, the new definition will override it but can never remove it. The list MUST
1103    * NOT include duplicated parameters. A unique parameter is defined by a combination of a name and
1104    * location. The list can use the Reference Object to link to parameters that are defined at the
1105    * OpenAPI Object's components/parameters.
1106    */
1107   @jsonOptional
1108   OasParameter[] parameters;  // |Ref
1109 
1110   /**
1111    * The request body applicable for this operation. The `requestBody` is only supported in HTTP
1112    * methods where the HTTP 1.1 specification
1113    * [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics
1114    * for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored
1115    * by consumers.
1116    */
1117   @jsonOptional
1118   OasRequestBody requestBody; // |Ref
1119 
1120   /**
1121    * **REQUIRED**. The list of possible responses as they are returned from executing this
1122    * operation.
1123    */
1124   OasResponses responses;
1125 
1126   /**
1127    * A map of possible out-of band callbacks related to the parent operation. The key is a unique
1128    * identifier for the [OasCallback] object. Each value in the map is a Callback Object that
1129    * describes a request that may be initiated by the API provider and the expected responses.
1130    */
1131   @jsonOptional
1132   OasCallback[string] callbacks; // |Ref
1133 
1134   /**
1135    * Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared
1136    * operation. Default value is false.
1137    */
1138   @jsonOptional
1139   bool deprecated_ = false;
1140 
1141   /**
1142    * A declaration of which security mechanisms can be used for this operation. The list of values
1143    * includes alternative security requirement objects that can be used. Only one of the security
1144    * requirement objects need to be satisfied to authorize a request. To make security optional, an
1145    * empty security requirement (`{}`) can be included in the array. This definition overrides any
1146    * declared top-level security. To remove a top-level security declaration, an empty array can be
1147    * used.
1148    */
1149   @jsonOptional
1150   OasSecurityRequirement[] security;
1151 
1152   /**
1153    * An alternative `server` array to service this operation. If an alternative `server` object is
1154    * specified at the Path Item Object or Root level, it will be overridden by this value.
1155    */
1156   @jsonOptional
1157   OasServer[] servers;
1158 }
1159 
1160 class OasExample {
1161   /**
1162    * A link to parameters defined in the [OasDocument's] components/examples.
1163    */
1164   @jsonName("$ref")
1165   @jsonOptional
1166   string ref_;
1167 
1168   /**
1169    * Short description for the example.
1170    */
1171   @jsonOptional
1172   string summary;
1173 
1174   /**
1175    * Long description for the example. [CommonMark syntax](https://spec.commonmark.org/) MAY be used
1176    * for rich text representation.
1177    */
1178   @jsonOptional
1179   string description;
1180 
1181   /**
1182    * Embedded literal example. The value field and externalValue field are mutually exclusive. To
1183    * represent examples of media types that cannot naturally represented in JSON or YAML, use a
1184    * string value to contain the example, escaping where necessary.
1185    */
1186   @jsonOptional
1187   Json value;
1188 
1189   /**
1190    * A URL that points to the literal example. This provides the capability to reference examples
1191    * that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue`
1192    * field are mutually exclusive.
1193    */
1194   @jsonOptional
1195   string externalValue;
1196 }
1197 
1198 class OasRequestBody {
1199   /**
1200    * A link to request bodies defined in the [OasDocument's] components/requestBodies.
1201    */
1202   @jsonName("$ref")
1203   @jsonOptional
1204   string ref_;
1205 
1206   /**
1207    * A brief description of the request body. This could contain examples of use. [CommonMark
1208    * syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
1209    */
1210   @jsonOptional
1211   string description;
1212 
1213   /**
1214    * **REQUIRED**. The content of the request body. The key is a media type or media type range and
1215    * the value describes it. For requests that match multiple keys, only the most specific key is
1216    * applicable. e.g. `text/plain` overrides `text/*`
1217    */
1218   @jsonOptional
1219   OasMediaType[string] content;
1220 
1221   /**
1222    * Determines if the request body is required in the request. Defaults to `false`.
1223    */
1224   @jsonOptional
1225   bool required = false;
1226 }
1227 
1228 /**
1229  * Defines a security scheme that can be used by the operations. Supported schemes are HTTP
1230  * authentication, an API key (either as a header, a cookie parameter or as a query parameter),
1231  * OAuth2's common flows (implicit, password, client credentials and authorization code) as defined
1232  * in [RFC6749](https://tools.ietf.org/html/rfc6749), and [OpenID Connect
1233  * Discovery](https://tools.ietf.org/html/draft-ietf-oauth-discovery-06).
1234  */
1235 class OasSecurityScheme {
1236   /**
1237    * A link to request bodies defined in the [OasDocument's] components/securitySchemes.
1238    */
1239   @jsonName("$ref")
1240   @jsonOptional
1241   string ref_;
1242 
1243   /**
1244    * **REQUIRED**. The type of the security scheme. Valid values are "apiKey", "http", "oauth2",
1245    * "openIdConnect".
1246    */
1247   @jsonOptional
1248   string type;
1249 
1250   /**
1251    * A short description for security scheme. [CommonMark syntax](https://spec.commonmark.org/) MAY
1252    * be used for rich text representation.
1253    */
1254   @jsonOptional
1255   string description;
1256 
1257   /**
1258    * **REQUIRED**. The name of the header, query or cookie parameter to be used.
1259    */
1260   @jsonOptional // Optional due to missing values in Stripe OpenAPI.
1261   string name;
1262 
1263   /**
1264    * **REQUIRED**. The location of the API key. Valid values are "query", "header" or "cookie".
1265    */
1266   @jsonOptional
1267   string in_;
1268 
1269   /**
1270    * **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header
1271    * as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1). The values used SHOULD
1272    * be registered in the [IANA Authentication Scheme
1273    * registry](https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml).
1274    */
1275   @jsonOptional
1276   string scheme;
1277 
1278   /**
1279    * A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually
1280    * generated by an authorization server, so this information is primarily for documentation
1281    * purposes.
1282    */
1283   @jsonOptional
1284   string bearerFormat;
1285 
1286   /**
1287    * **REQUIRED**. An object containing configuration information for the flow types supported.
1288    */
1289   @jsonOptional
1290   OasOAuthFlows flows;
1291 
1292   /**
1293    * **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the
1294    * form of a URL.
1295    */
1296   @jsonOptional
1297   string openIdConnectUrl;
1298 }
1299 
1300 /**
1301  * The Link object represents a possible design-time link for a response. The presence of a link
1302  * does not guarantee the caller's ability to successfully invoke it, rather it provides a known
1303  * relationship and traversal mechanism between responses and other operations.
1304  *
1305  * Unlike *dynamic* links (i.e. links provided in the response payload), the OAS linking
1306  * mechanism does not require link information in the runtime response.
1307  *
1308  * For computing links, and providing instructions to execute them, a [runtime
1309  * expression](https://swagger.io/specification/#runtime-expression) is used for accessing values in
1310  * an operation and using them as parameters while invoking the linked operation.
1311  *
1312  * See_Also: https://swagger.io/specification/#link-object
1313  */
1314 class OasLink {
1315   /**
1316    * A link to request bodies defined in the [OasDocument's] components/links.
1317    */
1318   @jsonName("$ref")
1319   @jsonOptional
1320   string ref_;
1321 
1322   /**
1323    * A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of
1324    * the `operationId` field, and MUST point to an [OasOperation] object. Relative `operationRef`
1325    * values MAY be used to locate an existing [OasOperation] object in the OpenAPI definition.
1326    */
1327   @jsonOptional
1328   string operationRef;
1329 
1330   /**
1331    * The name of an existing, resolvable OAS operation, as defined with a unique `operationId`. This
1332    * field is mutually exclusive of the `operationRef` field.
1333    */
1334   @jsonOptional
1335   string operationId;
1336 
1337   /**
1338    * A map representing parameters to pass to an operation as specified with `operationId` or
1339    * identified via `operationRef`. The key is the parameter name to be used, whereas the value can
1340    * be a constant or an expression to be evaluated and passed to the linked operation. The
1341    * parameter name can be qualified using the parameter location `[{in}.]{name}` for operations
1342    * that use the same parameter name in different locations (e.g. path.id).
1343    */
1344   @jsonOptional
1345   string[string] parameters; // TODO: Support Any type as map values.
1346 
1347   /**
1348    * A literal value or {expression} to use as a request body when calling the target operation.
1349    */
1350   @jsonOptional
1351   string requestBody;
1352 
1353   /**
1354    * A description of the link. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for
1355    * rich text representation.
1356    */
1357   @jsonOptional
1358   string description;
1359 
1360   /**
1361    * A server object to be used by the target operation.
1362    */
1363   @jsonOptional
1364   OasServer server;
1365 }
1366 
1367 /**
1368  * A map of possible out-of band callbacks related to the parent operation. Each value in the map is
1369  * a [OasPathItem] object that describes a set of requests that may be initiated by the API provider
1370  * and the expected responses. The key value used to identify the path item object is an expression,
1371  * evaluated at runtime, that identifies a URL to use for the callback operation.
1372  *
1373  * See_Also: https://swagger.io/specification/#callback-object
1374  */
1375 alias OasCallback = OasPathItem[string];
1376 
1377 
1378 /**
1379  * When request bodies or response payloads may be one of a number of different schemas, a
1380  * `discriminator` object can be used to aid in serialization, deserialization, and validation. The
1381  * discriminator is a specific object in a schema which is used to inform the consumer of the
1382  * specification of an alternative schema based on the value associated with it.
1383  *
1384  * When using the discriminator, *inline* schemas will not be considered.
1385  *
1386  * See_Also: https://swagger.io/specification/#discriminator-object
1387  */
1388 class OasDiscriminator {
1389   /**
1390    * **REQUIRED**. The name of the property in the payload that will hold the discriminator value.
1391    */
1392   string propertyName;
1393 
1394   /**
1395    * An object to hold mappings between payload values and schema names or references.
1396    */
1397   @jsonOptional
1398   string[string] mapping;
1399 }
1400 
1401 /**
1402  * A container for the expected responses of an operation. The container maps a HTTP response code
1403  * to the expected response.
1404  *
1405  * The documentation is not necessarily expected to cover all possible HTTP response codes because
1406  * they may not be known in advance. However, documentation is expected to cover a successful
1407  * operation response and any known errors.
1408  *
1409  * The `default` MAY be used as a default response object for all HTTP codes that are not covered
1410  * individually by the specification.
1411  *
1412  * The Responses Object MUST contain at least one response code, and it SHOULD be the response for a
1413  * successful operation call.
1414  */
1415 alias OasResponses = OasResponse[string];
1416 
1417 /**
1418  * Allows configuration of the supported OAuth Flows.
1419  */
1420 class OasOAuthFlows {
1421   /**
1422    * Configuration for the OAuth Implicit flow.
1423    */
1424   @jsonOptional
1425   OasOAuthFlow implicit;
1426 
1427   /**
1428    * Configuration for the OAuth Resource Owner Password flow.
1429    */
1430   @jsonOptional
1431   OasOAuthFlow password;
1432 
1433   /**
1434    * Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI
1435    * 2.0.
1436    */
1437   @jsonOptional
1438   OasOAuthFlow clientCredentials;
1439 
1440   /**
1441    * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI
1442    * 2.0.
1443    */
1444   @jsonOptional
1445   OasOAuthFlow authorizationCode;
1446 }
1447 
1448 /**
1449  * Configuration details for a supported OAuth Flow.
1450  */
1451 class OasOAuthFlow {
1452   /**
1453    * **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a
1454    * URL.
1455    */
1456   string authorizationUrl;
1457 
1458   /**
1459    * **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL.
1460    */
1461   string tokenUrl;
1462 
1463   /**
1464    * The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
1465    */
1466   @jsonOptional
1467   string refreshUrl;
1468 
1469   /**
1470    * **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name
1471    * and a short description for it. The map MAY be empty.
1472    */
1473   string[string] scopes;
1474 }