|
1 | 1 | package io.swagger.models; |
2 | 2 |
|
| 3 | +import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| 4 | +import com.fasterxml.jackson.annotation.JsonAnySetter; |
3 | 5 | import com.fasterxml.jackson.annotation.JsonIgnore; |
4 | 6 | import io.swagger.models.auth.SecuritySchemeDefinition; |
5 | 7 | import io.swagger.models.parameters.Parameter; |
@@ -27,6 +29,7 @@ public class Swagger { |
27 | 29 | protected Map<String, Parameter> parameters; |
28 | 30 | protected Map<String, Response> responses; |
29 | 31 | protected ExternalDocs externalDocs; |
| 32 | + protected Map<String, Object> vendorExtensions; |
30 | 33 |
|
31 | 34 | // builders |
32 | 35 | public Swagger info(Info info) { |
@@ -135,6 +138,14 @@ public Swagger security(SecurityRequirement securityRequirement) { |
135 | 138 | return this; |
136 | 139 | } |
137 | 140 |
|
| 141 | + public Swagger vendorExtension(String key, Object extension) { |
| 142 | + if(this.vendorExtensions == null) { |
| 143 | + this.vendorExtensions = new HashMap<String, Object>(); |
| 144 | + } |
| 145 | + this.vendorExtensions.put(key, extension); |
| 146 | + return this; |
| 147 | + } |
| 148 | + |
138 | 149 | // getter & setters |
139 | 150 | public String getSwagger() { |
140 | 151 | return swagger; |
@@ -372,6 +383,18 @@ public void setExternalDocs(ExternalDocs value) { |
372 | 383 | externalDocs = value; |
373 | 384 | } |
374 | 385 |
|
| 386 | + @JsonAnyGetter |
| 387 | + public Map<String, Object> getVendorExtensions() { |
| 388 | + return vendorExtensions; |
| 389 | + } |
| 390 | + |
| 391 | + @JsonAnySetter |
| 392 | + public void setVendorExtension(String name, Object value) { |
| 393 | + if (name.startsWith("x-")) { |
| 394 | + vendorExtensions.put(name, value); |
| 395 | + } |
| 396 | + } |
| 397 | + |
375 | 398 | @Override |
376 | 399 | public int hashCode() { |
377 | 400 | final int prime = 31; |
|
0 commit comments