@@ -34,6 +34,9 @@ type Spec struct {
34
34
// Each tag name in the list MUST be unique.
35
35
Tags []Tag `json:"tags,omitempty"`
36
36
37
+ // Additional external documentation.
38
+ ExternalDocs * ExternalDocumentation `json:"externalDocs,omitempty"`
39
+
37
40
// Raw JSON value. Used by JSON Schema resolver.
38
41
Raw []byte `json:"-"`
39
42
}
@@ -91,8 +94,9 @@ type Example struct {
91
94
//
92
95
// https://swagger.io/specification/#tag-object
93
96
type Tag struct {
94
- Name string `json:"name"`
95
- Description string `json:"description,omitempty"`
97
+ Name string `json:"name"`
98
+ Description string `json:"description,omitempty"`
99
+ ExternalDocs * ExternalDocumentation `json:"externalDocs,omitempty"`
96
100
}
97
101
98
102
// Info provides metadata about the API.
@@ -132,8 +136,29 @@ type License struct {
132
136
133
137
// Server represents a Server.
134
138
type Server struct {
139
+ // REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative,
140
+ // to indicate that the host location is relative to the location where the OpenAPI document is being served.
141
+ // Variable substitutions will be made when a variable is named in {brackets}.
142
+ URL string `json:"url"`
143
+ // An optional string describing the host designated by the URL.
144
+ // CommonMark syntax MAY be used for rich text representation.
145
+ Description string `json:"description,omitempty"`
146
+ // A map between a variable name and its value. The value is used for substitution in the server's URL template.
147
+ Variables map [string ]ServerVariable `json:"variables,omitempty"`
148
+ }
149
+
150
+ // ServerVariable describes an object representing a Server Variable for server URL template substitution.
151
+ type ServerVariable struct {
152
+ // An enumeration of string values to be used if the substitution options are from a limited set.
153
+ //
154
+ // The array MUST NOT be empty.
155
+ Enum []string `json:"enum,omitempty"`
156
+ // REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
157
+ // Note this behavior is different than the Schema Object’s treatment of default values, because in those
158
+ // cases parameter values are optional. If the enum is defined, the value MUST exist in the enum’s values.
159
+ Default string `json:"default"`
160
+ // An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
135
161
Description string `json:"description,omitempty"`
136
- URL string `json:"url"`
137
162
}
138
163
139
164
// Components hold a set of reusable objects for different aspects of the OAS.
@@ -186,8 +211,10 @@ type Operation struct {
186
211
// Tags can be used for logical grouping of operations by resources or any other qualifier.
187
212
Tags []string `json:"tags,omitempty"`
188
213
189
- Summary string `json:"summary,omitempty"`
190
- Description string `json:"description,omitempty"`
214
+ Summary string `json:"summary,omitempty"`
215
+ Description string `json:"description,omitempty"`
216
+ ExternalDocs * ExternalDocumentation `json:"externalDocs,omitempty"`
217
+
191
218
OperationID string `json:"operationId,omitempty"`
192
219
Parameters []* Parameter `json:"parameters,omitempty"`
193
220
RequestBody * RequestBody `json:"requestBody,omitempty"`
@@ -196,6 +223,14 @@ type Operation struct {
196
223
Deprecated bool `json:"deprecated,omitempty"`
197
224
}
198
225
226
+ // ExternalDocumentation describes a reference to external resource for extended documentation.
227
+ type ExternalDocumentation struct {
228
+ // A description of the target documentation. CommonMark syntax MAY be used for rich text representation.
229
+ Description string `json:"description,omitempty"`
230
+ // REQUIRED. The URL for the target documentation. This MUST be in the form of a URL.
231
+ URL string `json:"url"`
232
+ }
233
+
199
234
// Parameter describes a single operation parameter.
200
235
// A unique parameter is defined by a combination of a name and location.
201
236
type Parameter struct {
@@ -333,6 +368,9 @@ type Schema struct {
333
368
Summary string `json:"summary,omitempty"`
334
369
Description string `json:"description,omitempty"`
335
370
371
+ // Additional external documentation for this schema.
372
+ ExternalDocs * ExternalDocumentation `json:"externalDocs,omitempty"`
373
+
336
374
// Value MUST be a string. Multiple types via an array are not supported.
337
375
Type string `json:"type,omitempty"`
338
376
@@ -526,6 +564,27 @@ type Schema struct {
526
564
// Specifies that a schema is deprecated and SHOULD be transitioned out
527
565
// of usage.
528
566
Deprecated bool `json:"deprecated,omitempty"`
567
+
568
+ // If the instance value is a string, this property defines that the
569
+ // string SHOULD be interpreted as binary data and decoded using the
570
+ // encoding named by this property. RFC 2045, Section 6.1 lists
571
+ // the possible values for this property.
572
+ //
573
+ // The value of this property MUST be a string.
574
+ //
575
+ // The value of this property SHOULD be ignored if the instance
576
+ // described is not a string.
577
+ ContentEncoding string `json:"contentEncoding,omitempty"`
578
+
579
+ // The value of this property must be a media type, as defined by RFC
580
+ // 2046. This property defines the media type of instances
581
+ // which this schema defines.
582
+ //
583
+ // The value of this property MUST be a string.
584
+ //
585
+ // The value of this property SHOULD be ignored if the instance
586
+ // described is not a string.
587
+ ContentMediaType string `json:"contentMediaType,omitempty"`
529
588
}
530
589
531
590
// Property is item of Properties.
0 commit comments