Skip to content

Commit 68af3a6

Browse files
committed
updated spring samples
1 parent fdc4984 commit 68af3a6

File tree

74 files changed

+4951
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+4951
-25
lines changed

samples/client/petstore/spring-cloud-v2/src/main/java/io/swagger/api/PetApi.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.swagger.model.ModelApiResponse;
1010
import io.swagger.model.Pet;
1111
import io.swagger.model.SinglePetResponse;
12+
import io.swagger.model.SubCategory;
1213
import io.swagger.annotations.*;
1314
import org.springframework.http.ResponseEntity;
1415
import org.springframework.validation.annotation.Validated;
@@ -58,6 +59,17 @@ com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> deletePet(@ApiParam(val
5859
);
5960

6061

62+
@ApiOperation(value = "", nickname = "doCategoryStuff", notes = "", response = ModelApiResponse.class, tags={ "pet", })
63+
@ApiResponses(value = {
64+
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
65+
@RequestMapping(value = "/pet/category",
66+
produces = "application/json",
67+
consumes = "application/json",
68+
method = RequestMethod.POST)
69+
com.netflix.hystrix.HystrixCommand<ResponseEntity<ModelApiResponse>> doCategoryStuff(@ApiParam(value = "" ) @Valid @RequestBody SubCategory body
70+
);
71+
72+
6173
@ApiOperation(value = "Finds Pets by status", nickname = "findPetsByStatus", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
6274
@Authorization(value = "petstore_auth", scopes = {
6375
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
package io.swagger.model;
2+
3+
import java.util.Objects;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import com.fasterxml.jackson.annotation.JsonCreator;
6+
import io.swagger.annotations.ApiModel;
7+
import io.swagger.annotations.ApiModelProperty;
8+
import io.swagger.model.Category;
9+
import io.swagger.model.User;
10+
import org.springframework.validation.annotation.Validated;
11+
import javax.validation.Valid;
12+
import javax.validation.constraints.*;
13+
14+
/**
15+
* AllOfSubCategoryCategory
16+
*/
17+
@Validated
18+
public class AllOfSubCategoryCategory extends Category {
19+
@JsonProperty("foo")
20+
private Boolean foo = null;
21+
22+
@JsonProperty("bar")
23+
private Integer bar = null;
24+
25+
@JsonProperty("beer")
26+
private String beer = null;
27+
28+
@JsonProperty("drunk")
29+
private User drunk = null;
30+
31+
public AllOfSubCategoryCategory foo(Boolean foo) {
32+
this.foo = foo;
33+
return this;
34+
}
35+
36+
/**
37+
* Get foo
38+
* @return foo
39+
**/
40+
@ApiModelProperty(value = "")
41+
42+
public Boolean isFoo() {
43+
return foo;
44+
}
45+
46+
public void setFoo(Boolean foo) {
47+
this.foo = foo;
48+
}
49+
50+
public AllOfSubCategoryCategory bar(Integer bar) {
51+
this.bar = bar;
52+
return this;
53+
}
54+
55+
/**
56+
* Get bar
57+
* @return bar
58+
**/
59+
@ApiModelProperty(value = "")
60+
61+
public Integer getBar() {
62+
return bar;
63+
}
64+
65+
public void setBar(Integer bar) {
66+
this.bar = bar;
67+
}
68+
69+
public AllOfSubCategoryCategory beer(String beer) {
70+
this.beer = beer;
71+
return this;
72+
}
73+
74+
/**
75+
* Get beer
76+
* @return beer
77+
**/
78+
@ApiModelProperty(value = "")
79+
80+
public String getBeer() {
81+
return beer;
82+
}
83+
84+
public void setBeer(String beer) {
85+
this.beer = beer;
86+
}
87+
88+
public AllOfSubCategoryCategory drunk(User drunk) {
89+
this.drunk = drunk;
90+
return this;
91+
}
92+
93+
/**
94+
* Get drunk
95+
* @return drunk
96+
**/
97+
@ApiModelProperty(value = "")
98+
99+
@Valid
100+
public User getDrunk() {
101+
return drunk;
102+
}
103+
104+
public void setDrunk(User drunk) {
105+
this.drunk = drunk;
106+
}
107+
108+
109+
@Override
110+
public boolean equals(java.lang.Object o) {
111+
if (this == o) {
112+
return true;
113+
}
114+
if (o == null || getClass() != o.getClass()) {
115+
return false;
116+
}
117+
AllOfSubCategoryCategory allOfSubCategoryCategory = (AllOfSubCategoryCategory) o;
118+
return Objects.equals(this.foo, allOfSubCategoryCategory.foo) &&
119+
Objects.equals(this.bar, allOfSubCategoryCategory.bar) &&
120+
Objects.equals(this.beer, allOfSubCategoryCategory.beer) &&
121+
Objects.equals(this.drunk, allOfSubCategoryCategory.drunk) &&
122+
super.equals(o);
123+
}
124+
125+
@Override
126+
public int hashCode() {
127+
return Objects.hash(foo, bar, beer, drunk, super.hashCode());
128+
}
129+
130+
@Override
131+
public String toString() {
132+
StringBuilder sb = new StringBuilder();
133+
sb.append("class AllOfSubCategoryCategory {\n");
134+
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
135+
sb.append(" foo: ").append(toIndentedString(foo)).append("\n");
136+
sb.append(" bar: ").append(toIndentedString(bar)).append("\n");
137+
sb.append(" beer: ").append(toIndentedString(beer)).append("\n");
138+
sb.append(" drunk: ").append(toIndentedString(drunk)).append("\n");
139+
sb.append("}");
140+
return sb.toString();
141+
}
142+
143+
/**
144+
* Convert the given object to string with each line indented by 4 spaces
145+
* (except the first line).
146+
*/
147+
private String toIndentedString(java.lang.Object o) {
148+
if (o == null) {
149+
return "null";
150+
}
151+
return o.toString().replace("\n", "\n ");
152+
}
153+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package io.swagger.model;
2+
3+
import java.util.Objects;
4+
import io.swagger.model.Category;
5+
import io.swagger.model.Pet;
6+
import io.swagger.model.Tag;
7+
import java.util.List;
8+
import org.springframework.validation.annotation.Validated;
9+
import javax.validation.Valid;
10+
import javax.validation.constraints.*;
11+
12+
/**
13+
* AllOfSubCategoryPetsItems
14+
*/
15+
@Validated
16+
public class AllOfSubCategoryPetsItems extends Pet {
17+
18+
@Override
19+
public boolean equals(java.lang.Object o) {
20+
if (this == o) {
21+
return true;
22+
}
23+
if (o == null || getClass() != o.getClass()) {
24+
return false;
25+
}
26+
return true;
27+
}
28+
29+
@Override
30+
public int hashCode() {
31+
return Objects.hash(super.hashCode());
32+
}
33+
34+
@Override
35+
public String toString() {
36+
StringBuilder sb = new StringBuilder();
37+
sb.append("class AllOfSubCategoryPetsItems {\n");
38+
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
39+
sb.append("}");
40+
return sb.toString();
41+
}
42+
43+
/**
44+
* Convert the given object to string with each line indented by 4 spaces
45+
* (except the first line).
46+
*/
47+
private String toIndentedString(java.lang.Object o) {
48+
if (o == null) {
49+
return "null";
50+
}
51+
return o.toString().replace("\n", "\n ");
52+
}
53+
}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
package io.swagger.model;
2+
3+
import java.util.Objects;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import com.fasterxml.jackson.annotation.JsonCreator;
6+
import io.swagger.annotations.ApiModel;
7+
import io.swagger.annotations.ApiModelProperty;
8+
import io.swagger.model.Category;
9+
import java.util.ArrayList;
10+
import java.util.List;
11+
import org.springframework.validation.annotation.Validated;
12+
import javax.validation.Valid;
13+
import javax.validation.constraints.*;
14+
15+
/**
16+
* SubCategory
17+
*/
18+
@Validated
19+
public class SubCategory {
20+
@JsonProperty("category")
21+
private AllOfSubCategoryCategory category = null;
22+
23+
@JsonProperty("category2")
24+
private Category category2 = null;
25+
26+
@JsonProperty("pets")
27+
@Valid
28+
private List<AllOfSubCategoryPetsItems> pets = null;
29+
30+
public SubCategory category(AllOfSubCategoryCategory category) {
31+
this.category = category;
32+
return this;
33+
}
34+
35+
/**
36+
* Get category
37+
* @return category
38+
**/
39+
@ApiModelProperty(value = "")
40+
41+
public AllOfSubCategoryCategory getCategory() {
42+
return category;
43+
}
44+
45+
public void setCategory(AllOfSubCategoryCategory category) {
46+
this.category = category;
47+
}
48+
49+
public SubCategory category2(Category category2) {
50+
this.category2 = category2;
51+
return this;
52+
}
53+
54+
/**
55+
* Get category2
56+
* @return category2
57+
**/
58+
@ApiModelProperty(value = "")
59+
60+
@Valid
61+
public Category getCategory2() {
62+
return category2;
63+
}
64+
65+
public void setCategory2(Category category2) {
66+
this.category2 = category2;
67+
}
68+
69+
public SubCategory pets(List<AllOfSubCategoryPetsItems> pets) {
70+
this.pets = pets;
71+
return this;
72+
}
73+
74+
public SubCategory addPetsItem(AllOfSubCategoryPetsItems petsItem) {
75+
if (this.pets == null) {
76+
this.pets = new ArrayList<AllOfSubCategoryPetsItems>();
77+
}
78+
this.pets.add(petsItem);
79+
return this;
80+
}
81+
82+
/**
83+
* Get pets
84+
* @return pets
85+
**/
86+
@ApiModelProperty(value = "")
87+
88+
public List<AllOfSubCategoryPetsItems> getPets() {
89+
return pets;
90+
}
91+
92+
public void setPets(List<AllOfSubCategoryPetsItems> pets) {
93+
this.pets = pets;
94+
}
95+
96+
97+
@Override
98+
public boolean equals(java.lang.Object o) {
99+
if (this == o) {
100+
return true;
101+
}
102+
if (o == null || getClass() != o.getClass()) {
103+
return false;
104+
}
105+
SubCategory subCategory = (SubCategory) o;
106+
return Objects.equals(this.category, subCategory.category) &&
107+
Objects.equals(this.category2, subCategory.category2) &&
108+
Objects.equals(this.pets, subCategory.pets);
109+
}
110+
111+
@Override
112+
public int hashCode() {
113+
return Objects.hash(category, category2, pets);
114+
}
115+
116+
@Override
117+
public String toString() {
118+
StringBuilder sb = new StringBuilder();
119+
sb.append("class SubCategory {\n");
120+
121+
sb.append(" category: ").append(toIndentedString(category)).append("\n");
122+
sb.append(" category2: ").append(toIndentedString(category2)).append("\n");
123+
sb.append(" pets: ").append(toIndentedString(pets)).append("\n");
124+
sb.append("}");
125+
return sb.toString();
126+
}
127+
128+
/**
129+
* Convert the given object to string with each line indented by 4 spaces
130+
* (except the first line).
131+
*/
132+
private String toIndentedString(java.lang.Object o) {
133+
if (o == null) {
134+
return "null";
135+
}
136+
return o.toString().replace("\n", "\n ");
137+
}
138+
}

samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.swagger.model.ModelApiResponse;
1010
import io.swagger.model.Pet;
1111
import io.swagger.model.SinglePetResponse;
12+
import io.swagger.model.SubCategory;
1213
import io.swagger.annotations.*;
1314
import org.springframework.http.ResponseEntity;
1415
import org.springframework.validation.annotation.Validated;
@@ -58,6 +59,17 @@ com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> deletePet(@ApiParam(val
5859
);
5960

6061

62+
@ApiOperation(value = "", nickname = "doCategoryStuff", notes = "", response = ModelApiResponse.class, tags={ "pet", })
63+
@ApiResponses(value = {
64+
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
65+
@RequestMapping(value = "/pet/category",
66+
produces = "application/json",
67+
consumes = "application/json",
68+
method = RequestMethod.POST)
69+
com.netflix.hystrix.HystrixCommand<ResponseEntity<ModelApiResponse>> doCategoryStuff(@ApiParam(value = "" ) @Valid @RequestBody SubCategory body
70+
);
71+
72+
6173
@ApiOperation(value = "Finds Pets by status", nickname = "findPetsByStatus", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
6274
@Authorization(value = "petstore_auth", scopes = {
6375
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),

0 commit comments

Comments
 (0)