Skip to content

Commit 17a55cb

Browse files
committed
updated java feign sample
1 parent d82a552 commit 17a55cb

File tree

7 files changed

+217
-2
lines changed

7 files changed

+217
-2
lines changed

samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import io.swagger.client.ApiClient;
44
import io.swagger.client.EncodingUtils;
55

6+
import io.swagger.client.model.AllPetsResponse;
67
import java.io.File;
78
import io.swagger.client.model.ModelApiResponse;
89
import io.swagger.client.model.Pet;
10+
import io.swagger.client.model.SinglePetResponse;
911

1012
import java.util.ArrayList;
1113
import java.util.HashMap;
@@ -129,6 +131,16 @@ public FindPetsByTagsQueryParams tags(final List<String> value) {
129131
return this;
130132
}
131133
}
134+
/**
135+
*
136+
*
137+
* @return AllPetsResponse
138+
*/
139+
@RequestLine("GET /allPets")
140+
@Headers({
141+
"Accept: application/json",
142+
})
143+
AllPetsResponse getAllPets();
132144
/**
133145
* Find pet by ID
134146
* Returns a single pet
@@ -140,6 +152,16 @@ public FindPetsByTagsQueryParams tags(final List<String> value) {
140152
"Accept: application/json",
141153
})
142154
Pet getPetById(@Param("petId") Long petId);
155+
/**
156+
*
157+
*
158+
* @return SinglePetResponse
159+
*/
160+
@RequestLine("GET /randomPet")
161+
@Headers({
162+
"Accept: application/json",
163+
})
164+
SinglePetResponse getRandomPet();
143165
/**
144166
* Update an existing pet
145167
*
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Swagger Petstore
3+
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
4+
*
5+
* OpenAPI spec version: 1.0.0
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package io.swagger.client.model;
14+
15+
import java.util.Objects;
16+
import java.util.Arrays;
17+
import io.swagger.client.model.OneOfAllPetsResponseItems;
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
/**
21+
* AllPetsResponse
22+
*/
23+
24+
25+
public class AllPetsResponse extends ArrayList<OneOfAllPetsResponseItems> {
26+
27+
@Override
28+
public boolean equals(java.lang.Object o) {
29+
if (this == o) {
30+
return true;
31+
}
32+
if (o == null || getClass() != o.getClass()) {
33+
return false;
34+
}
35+
return super.equals(o);
36+
}
37+
38+
@Override
39+
public int hashCode() {
40+
return Objects.hash(super.hashCode());
41+
}
42+
43+
44+
@Override
45+
public String toString() {
46+
StringBuilder sb = new StringBuilder();
47+
sb.append("class AllPetsResponse {\n");
48+
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
49+
sb.append("}");
50+
return sb.toString();
51+
}
52+
53+
/**
54+
* Convert the given object to string with each line indented by 4 spaces
55+
* (except the first line).
56+
*/
57+
private String toIndentedString(java.lang.Object o) {
58+
if (o == null) {
59+
return "null";
60+
}
61+
return o.toString().replace("\n", "\n ");
62+
}
63+
64+
}

samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626

27-
public class Cat extends Animal {
27+
public class Cat extends Animal implements OneOfAllPetsResponseItems, OneOfSinglePetResponsePet {
2828
@JsonProperty("declawed")
2929
private Boolean declawed = null;
3030

samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626

27-
public class Dog extends Animal {
27+
public class Dog extends Animal implements OneOfAllPetsResponseItems, OneOfSinglePetResponsePet {
2828
@JsonProperty("breed")
2929
private String breed = null;
3030

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Swagger Petstore
3+
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
4+
*
5+
* OpenAPI spec version: 1.0.0
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package io.swagger.client.model;
14+
15+
/**
16+
* OneOfAllPetsResponseItems
17+
*/
18+
public interface OneOfAllPetsResponseItems {
19+
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Swagger Petstore
3+
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
4+
*
5+
* OpenAPI spec version: 1.0.0
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package io.swagger.client.model;
14+
15+
/**
16+
* OneOfSinglePetResponsePet
17+
*/
18+
public interface OneOfSinglePetResponsePet {
19+
20+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* Swagger Petstore
3+
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
4+
*
5+
* OpenAPI spec version: 1.0.0
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*/
12+
13+
package io.swagger.client.model;
14+
15+
import java.util.Objects;
16+
import java.util.Arrays;
17+
import com.fasterxml.jackson.annotation.JsonProperty;
18+
import com.fasterxml.jackson.annotation.JsonCreator;
19+
import com.fasterxml.jackson.annotation.JsonValue;
20+
import io.swagger.client.model.OneOfSinglePetResponsePet;
21+
import io.swagger.v3.oas.annotations.media.Schema;
22+
/**
23+
* SinglePetResponse
24+
*/
25+
26+
27+
public class SinglePetResponse {
28+
@JsonProperty("pet")
29+
private OneOfSinglePetResponsePet pet = null;
30+
31+
public SinglePetResponse pet(OneOfSinglePetResponsePet pet) {
32+
this.pet = pet;
33+
return this;
34+
}
35+
36+
/**
37+
* Get pet
38+
* @return pet
39+
**/
40+
@Schema(description = "")
41+
public OneOfSinglePetResponsePet getPet() {
42+
return pet;
43+
}
44+
45+
public void setPet(OneOfSinglePetResponsePet pet) {
46+
this.pet = pet;
47+
}
48+
49+
50+
@Override
51+
public boolean equals(java.lang.Object o) {
52+
if (this == o) {
53+
return true;
54+
}
55+
if (o == null || getClass() != o.getClass()) {
56+
return false;
57+
}
58+
SinglePetResponse singlePetResponse = (SinglePetResponse) o;
59+
return Objects.equals(this.pet, singlePetResponse.pet);
60+
}
61+
62+
@Override
63+
public int hashCode() {
64+
return Objects.hash(pet);
65+
}
66+
67+
68+
@Override
69+
public String toString() {
70+
StringBuilder sb = new StringBuilder();
71+
sb.append("class SinglePetResponse {\n");
72+
73+
sb.append(" pet: ").append(toIndentedString(pet)).append("\n");
74+
sb.append("}");
75+
return sb.toString();
76+
}
77+
78+
/**
79+
* Convert the given object to string with each line indented by 4 spaces
80+
* (except the first line).
81+
*/
82+
private String toIndentedString(java.lang.Object o) {
83+
if (o == null) {
84+
return "null";
85+
}
86+
return o.toString().replace("\n", "\n ");
87+
}
88+
89+
}

0 commit comments

Comments
 (0)