Skip to content

Commit 119db11

Browse files
committed
Adding the necessary files from building the petstore with the changed approach so tests pass as expected
1 parent ee53437 commit 119db11

17 files changed

Lines changed: 334 additions & 10 deletions

File tree

samples/server/petstore/jaxrs-cxf-cdi/.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ src/gen/java/org/openapitools/api/TestApi.java
77
src/gen/java/org/openapitools/api/TestApiService.java
88
src/gen/java/org/openapitools/api/UserApi.java
99
src/gen/java/org/openapitools/api/UserApiService.java
10+
src/gen/java/org/openapitools/model/CatRequest.java
1011
src/gen/java/org/openapitools/model/Category.java
12+
src/gen/java/org/openapitools/model/DogRequest.java
1113
src/gen/java/org/openapitools/model/ModelApiResponse.java
1214
src/gen/java/org/openapitools/model/Order.java
1315
src/gen/java/org/openapitools/model/Pet.java
16+
src/gen/java/org/openapitools/model/PetRequest.java
1417
src/gen/java/org/openapitools/model/Tag.java
1518
src/gen/java/org/openapitools/model/User.java
1619
src/main/java/org/openapitools/api/RestApplication.java

samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApi.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.openapitools.model.ModelApiResponse;
44
import org.openapitools.model.Pet;
5+
import org.openapitools.model.PetRequest;
56
import org.openapitools.api.PetApiService;
67

78
import javax.ws.rs.*;
@@ -53,6 +54,17 @@ public Response addPet(@ApiParam(value = "Pet object that needs to be added to t
5354
return delegate.addPet(pet, securityContext);
5455
}
5556

57+
@POST
58+
@Path("/request")
59+
@Consumes({ "application/json" })
60+
@Produces({ "application/json" })
61+
@ApiOperation(value = "", notes = "", response = PetRequest.class, tags={ "pet" })
62+
@ApiResponses(value = {
63+
@ApiResponse(code = 201, message = "Pet created successfully", response = PetRequest.class) })
64+
public Response createPetRequest(@ApiParam(value = "" ,required=true) PetRequest petRequest) {
65+
return delegate.createPetRequest(petRequest, securityContext);
66+
}
67+
5668
@DELETE
5769
@Path("/{petId}")
5870

samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApiService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import org.openapitools.model.ModelApiResponse;
1010
import org.openapitools.model.Pet;
11+
import org.openapitools.model.PetRequest;
1112

1213
import java.util.List;
1314

@@ -22,6 +23,7 @@
2223
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen", comments = "Generator version: 7.22.0-SNAPSHOT")
2324
public interface PetApiService {
2425
public Response addPet(Pet pet, SecurityContext securityContext);
26+
public Response createPetRequest(PetRequest petRequest, SecurityContext securityContext);
2527
public Response deletePet(Long petId, SecurityContext securityContext);
2628
public Response findPetsByStatus(List<String> status, SecurityContext securityContext);
2729
@Deprecated public Response findPetsByTags(List<String> tags, SecurityContext securityContext);
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package org.openapitools.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import com.fasterxml.jackson.annotation.JsonCreator;
5+
import io.swagger.annotations.ApiModel;
6+
import io.swagger.annotations.ApiModelProperty;
7+
import org.openapitools.model.PetRequest;
8+
import javax.validation.constraints.*;
9+
import javax.validation.Valid;
10+
11+
12+
import io.swagger.annotations.*;
13+
import java.util.Objects;
14+
15+
16+
17+
public class CatRequest extends PetRequest {
18+
19+
private Boolean indoor;
20+
21+
/**
22+
**/
23+
public CatRequest indoor(Boolean indoor) {
24+
this.indoor = indoor;
25+
return this;
26+
}
27+
28+
29+
@ApiModelProperty(value = "")
30+
@JsonProperty("indoor")
31+
public Boolean getIndoor() {
32+
return indoor;
33+
}
34+
public void setIndoor(Boolean indoor) {
35+
this.indoor = indoor;
36+
}
37+
38+
39+
40+
@Override
41+
public boolean equals(Object o) {
42+
if (this == o) {
43+
return true;
44+
}
45+
if (o == null || getClass() != o.getClass()) {
46+
return false;
47+
}
48+
CatRequest catRequest = (CatRequest) o;
49+
return super.equals(o) && Objects.equals(this.indoor, catRequest.indoor);
50+
}
51+
52+
@Override
53+
public int hashCode() {
54+
return Objects.hash(super.hashCode(), indoor);
55+
}
56+
57+
@Override
58+
public String toString() {
59+
StringBuilder sb = new StringBuilder();
60+
sb.append("class CatRequest {\n");
61+
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
62+
sb.append(" indoor: ").append(toIndentedString(indoor)).append("\n");
63+
sb.append("}");
64+
return sb.toString();
65+
}
66+
67+
/**
68+
* Convert the given object to string with each line indented by 4 spaces
69+
* (except the first line).
70+
*/
71+
private String toIndentedString(Object o) {
72+
return o == null ? "null" : o.toString().replace("\n", "\n ");
73+
}
74+
}
75+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package org.openapitools.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import com.fasterxml.jackson.annotation.JsonCreator;
5+
import io.swagger.annotations.ApiModel;
6+
import io.swagger.annotations.ApiModelProperty;
7+
import org.openapitools.model.PetRequest;
8+
import javax.validation.constraints.*;
9+
import javax.validation.Valid;
10+
11+
12+
import io.swagger.annotations.*;
13+
import java.util.Objects;
14+
15+
16+
17+
public class DogRequest extends PetRequest {
18+
19+
private String bark;
20+
21+
/**
22+
**/
23+
public DogRequest bark(String bark) {
24+
this.bark = bark;
25+
return this;
26+
}
27+
28+
29+
@ApiModelProperty(value = "")
30+
@JsonProperty("bark")
31+
public String getBark() {
32+
return bark;
33+
}
34+
public void setBark(String bark) {
35+
this.bark = bark;
36+
}
37+
38+
39+
40+
@Override
41+
public boolean equals(Object o) {
42+
if (this == o) {
43+
return true;
44+
}
45+
if (o == null || getClass() != o.getClass()) {
46+
return false;
47+
}
48+
DogRequest dogRequest = (DogRequest) o;
49+
return super.equals(o) && Objects.equals(this.bark, dogRequest.bark);
50+
}
51+
52+
@Override
53+
public int hashCode() {
54+
return Objects.hash(super.hashCode(), bark);
55+
}
56+
57+
@Override
58+
public String toString() {
59+
StringBuilder sb = new StringBuilder();
60+
sb.append("class DogRequest {\n");
61+
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
62+
sb.append(" bark: ").append(toIndentedString(bark)).append("\n");
63+
sb.append("}");
64+
return sb.toString();
65+
}
66+
67+
/**
68+
* Convert the given object to string with each line indented by 4 spaces
69+
* (except the first line).
70+
*/
71+
private String toIndentedString(Object o) {
72+
return o == null ? "null" : o.toString().replace("\n", "\n ");
73+
}
74+
}
75+
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
package org.openapitools.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import com.fasterxml.jackson.annotation.JsonCreator;
6+
import com.fasterxml.jackson.annotation.JsonSubTypes;
7+
import com.fasterxml.jackson.annotation.JsonTypeInfo;
8+
import io.swagger.annotations.ApiModel;
9+
import io.swagger.annotations.ApiModelProperty;
10+
import org.openapitools.model.CatRequest;
11+
import org.openapitools.model.DogRequest;
12+
import javax.validation.constraints.*;
13+
import javax.validation.Valid;
14+
15+
16+
import io.swagger.annotations.*;
17+
import java.util.Objects;
18+
19+
20+
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "petType", visible = true)
21+
@JsonSubTypes({
22+
@JsonSubTypes.Type(value = CatRequest.class, name = "CAT"),
23+
@JsonSubTypes.Type(value = DogRequest.class, name = "DOG"),
24+
})
25+
26+
public class PetRequest {
27+
28+
private String petType;
29+
30+
private String name;
31+
32+
private String bark;
33+
34+
private Boolean indoor;
35+
36+
/**
37+
**/
38+
public PetRequest petType(String petType) {
39+
this.petType = petType;
40+
return this;
41+
}
42+
43+
44+
@ApiModelProperty(required = true, value = "")
45+
@JsonProperty("petType")
46+
@NotNull
47+
public String getPetType() {
48+
return petType;
49+
}
50+
public void setPetType(String petType) {
51+
this.petType = petType;
52+
}
53+
54+
55+
/**
56+
**/
57+
public PetRequest name(String name) {
58+
this.name = name;
59+
return this;
60+
}
61+
62+
63+
@ApiModelProperty(value = "")
64+
@JsonProperty("name")
65+
public String getName() {
66+
return name;
67+
}
68+
public void setName(String name) {
69+
this.name = name;
70+
}
71+
72+
73+
/**
74+
**/
75+
public PetRequest bark(String bark) {
76+
this.bark = bark;
77+
return this;
78+
}
79+
80+
81+
@ApiModelProperty(value = "")
82+
@JsonProperty("bark")
83+
public String getBark() {
84+
return bark;
85+
}
86+
public void setBark(String bark) {
87+
this.bark = bark;
88+
}
89+
90+
91+
/**
92+
**/
93+
public PetRequest indoor(Boolean indoor) {
94+
this.indoor = indoor;
95+
return this;
96+
}
97+
98+
99+
@ApiModelProperty(value = "")
100+
@JsonProperty("indoor")
101+
public Boolean getIndoor() {
102+
return indoor;
103+
}
104+
public void setIndoor(Boolean indoor) {
105+
this.indoor = indoor;
106+
}
107+
108+
109+
110+
@Override
111+
public boolean equals(Object o) {
112+
if (this == o) {
113+
return true;
114+
}
115+
if (o == null || getClass() != o.getClass()) {
116+
return false;
117+
}
118+
PetRequest petRequest = (PetRequest) o;
119+
return Objects.equals(this.petType, petRequest.petType) &&
120+
Objects.equals(this.name, petRequest.name) &&
121+
Objects.equals(this.bark, petRequest.bark) &&
122+
Objects.equals(this.indoor, petRequest.indoor);
123+
}
124+
125+
@Override
126+
public int hashCode() {
127+
return Objects.hash(petType, name, bark, indoor);
128+
}
129+
130+
@Override
131+
public String toString() {
132+
StringBuilder sb = new StringBuilder();
133+
sb.append("class PetRequest {\n");
134+
135+
sb.append(" petType: ").append(toIndentedString(petType)).append("\n");
136+
sb.append(" name: ").append(toIndentedString(name)).append("\n");
137+
sb.append(" bark: ").append(toIndentedString(bark)).append("\n");
138+
sb.append(" indoor: ").append(toIndentedString(indoor)).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(Object o) {
148+
return o == null ? "null" : o.toString().replace("\n", "\n ");
149+
}
150+
}
151+

samples/server/petstore/jaxrs-cxf-cdi/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import org.openapitools.model.ModelApiResponse;
99
import org.openapitools.model.Pet;
10+
import org.openapitools.model.PetRequest;
1011

1112
import java.util.List;
1213

@@ -26,6 +27,11 @@ public class PetApiServiceImpl implements PetApiService {
2627
public Response addPet(Pet pet, SecurityContext securityContext) {
2728
// do some magic!
2829
return Response.ok().entity("magic!").build();
30+
}
31+
@Override
32+
public Response createPetRequest(PetRequest petRequest, SecurityContext securityContext) {
33+
// do some magic!
34+
return Response.ok().entity("magic!").build();
2935
}
3036
@Override
3137
public Response deletePet(Long petId, SecurityContext securityContext) {

samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/Cat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
@org.eclipse.microprofile.openapi.annotations.media.Schema(description="")
18-
@JsonTypeName("Cat")
18+
@JsonTypeName("CAT")
1919
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.22.0-SNAPSHOT")
2020
public class Cat extends Animal implements Serializable {
2121
private Boolean declawed;

samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/model/Dog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
@org.eclipse.microprofile.openapi.annotations.media.Schema(description="")
18-
@JsonTypeName("Dog")
18+
@JsonTypeName("DOG")
1919
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.22.0-SNAPSHOT")
2020
public class Dog extends Animal implements Serializable {
2121
private String breed;

0 commit comments

Comments
 (0)