-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing getResponse and getPaths from Swagger #719
- Loading branch information
1 parent
6d6d46e
commit 291cfd8
Showing
5 changed files
with
208 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
modules/swagger-models/src/main/java/io/swagger/models/Paths.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package io.swagger.models; | ||
|
||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Objects; | ||
|
||
public class Paths extends LinkedHashMap<String, Path> { | ||
public Paths() { | ||
} | ||
|
||
private java.util.Map<String, Object> vendorExtensions = null; | ||
|
||
public Paths addPath(String name, Path item) { | ||
this.put(name, item); | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean equals(java.lang.Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
Paths paths = (Paths) o; | ||
return Objects.equals(this.vendorExtensions, paths.vendorExtensions) && | ||
super.equals(o); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(vendorExtensions, super.hashCode()); | ||
} | ||
|
||
public java.util.Map<String, Object> getVendorExtensions() { | ||
return vendorExtensions; | ||
} | ||
|
||
public void addVendorExtension(String name, Object value) { | ||
if (name == null || name.isEmpty() || !name.startsWith("x-")) { | ||
return; | ||
} | ||
if (this.vendorExtensions == null) { | ||
this.vendorExtensions = new java.util.HashMap<>(); | ||
} | ||
this.vendorExtensions.put(name, value); | ||
} | ||
|
||
public void setVendorExtensions(java.util.Map<String, Object> extensions) { | ||
this.vendorExtensions = extensions; | ||
} | ||
|
||
public Paths vendorExtensions(java.util.Map<String, Object> extensions) { | ||
this.vendorExtensions = extensions; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("class Paths {\n"); | ||
sb.append(" ").append(toIndentedString(super.toString())).append("\n"); | ||
sb.append("}"); | ||
return sb.toString(); | ||
} | ||
|
||
/** | ||
* Convert the given object to string with each line indented by 4 spaces | ||
* (except the first line). | ||
*/ | ||
private String toIndentedString(java.lang.Object o) { | ||
if (o == null) { | ||
return "null"; | ||
} | ||
return o.toString().replace("\n", "\n "); | ||
} | ||
|
||
} | ||
|
102 changes: 102 additions & 0 deletions
102
modules/swagger-models/src/main/java/io/swagger/models/Responses.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package io.swagger.models; | ||
|
||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Objects; | ||
|
||
public class Responses extends LinkedHashMap<String, Response> { | ||
|
||
public static final String DEFAULT = "default"; | ||
|
||
private java.util.Map<String, Object> vendorExtensions = null; | ||
|
||
public Responses addResponse(String name, Response item) { | ||
this.put(name, item); | ||
return this; | ||
} | ||
|
||
/** | ||
* returns the default property from a ApiResponses instance. | ||
* | ||
* @return ApiResponse _default | ||
**/ | ||
|
||
public Response getDefault() { | ||
return this.get(DEFAULT); | ||
} | ||
|
||
public void setDefault(Response _default) { | ||
addResponse(DEFAULT, _default); | ||
} | ||
|
||
public Responses _default(Response _default) { | ||
setDefault(_default); | ||
return this; | ||
} | ||
|
||
public java.util.Map<String, Object> getVendorExtensions() { | ||
return vendorExtensions; | ||
} | ||
|
||
public void addVendorExtension(String name, Object value) { | ||
if (name == null || name.isEmpty() || !name.startsWith("x-")) { | ||
return; | ||
} | ||
if (this.vendorExtensions == null) { | ||
this.vendorExtensions = new java.util.HashMap<>(); | ||
} | ||
this.vendorExtensions.put(name, value); | ||
} | ||
|
||
public void setVendorExtensions(java.util.Map<String, Object> extensions) { | ||
this.vendorExtensions = extensions; | ||
} | ||
|
||
public Responses vendorExtensions(java.util.Map<String, Object> extensions) { | ||
this.vendorExtensions = extensions; | ||
return this; | ||
} | ||
|
||
|
||
@Override | ||
public boolean equals(java.lang.Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
if (!super.equals(o)) { | ||
return false; | ||
} | ||
Responses apiResponses = (Responses) o; | ||
return Objects.equals(this.vendorExtensions, apiResponses.vendorExtensions); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(super.hashCode(), vendorExtensions); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("class ApiResponses {\n"); | ||
sb.append(" ").append(toIndentedString(super.toString())).append("\n"); | ||
sb.append(" vendorExtensions: ").append(toIndentedString(vendorExtensions)).append("\n"); | ||
sb.append("}"); | ||
return sb.toString(); | ||
} | ||
|
||
/** | ||
* Convert the given object to string with each line indented by 4 spaces | ||
* (except the first line). | ||
*/ | ||
private String toIndentedString(java.lang.Object o) { | ||
if (o == null) { | ||
return "null"; | ||
} | ||
return o.toString().replace("\n", "\n "); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters