Skip to content

Commit 2f69ad9

Browse files
committed
update java samples
1 parent e5437e0 commit 2f69ad9

File tree

44 files changed

+509
-41
lines changed

Some content is hidden

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

44 files changed

+509
-41
lines changed

samples/client/others/java/webclient-sealedInterface/.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ api/openapi.yaml
66
build.gradle
77
build.sbt
88
docs/Addressable.md
9+
docs/Animal.md
910
docs/Apple.md
1011
docs/Banana.md
1112
docs/Bar.md
1213
docs/BarApi.md
1314
docs/BarCreate.md
1415
docs/BarRef.md
1516
docs/BarRefOrValue.md
17+
docs/Cat.md
18+
docs/Dog.md
1619
docs/Entity.md
1720
docs/EntityRef.md
1821
docs/Extensible.md
@@ -49,12 +52,15 @@ src/main/java/org/openapitools/client/auth/Authentication.java
4952
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
5053
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
5154
src/main/java/org/openapitools/client/model/Addressable.java
55+
src/main/java/org/openapitools/client/model/Animal.java
5256
src/main/java/org/openapitools/client/model/Apple.java
5357
src/main/java/org/openapitools/client/model/Banana.java
5458
src/main/java/org/openapitools/client/model/Bar.java
5559
src/main/java/org/openapitools/client/model/BarCreate.java
5660
src/main/java/org/openapitools/client/model/BarRef.java
5761
src/main/java/org/openapitools/client/model/BarRefOrValue.java
62+
src/main/java/org/openapitools/client/model/Cat.java
63+
src/main/java/org/openapitools/client/model/Dog.java
5864
src/main/java/org/openapitools/client/model/Entity.java
5965
src/main/java/org/openapitools/client/model/EntityRef.java
6066
src/main/java/org/openapitools/client/model/Extensible.java

samples/client/others/java/webclient-sealedInterface/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,15 @@ Class | Method | HTTP request | Description
124124
## Documentation for Models
125125

126126
- [Addressable](docs/Addressable.md)
127+
- [Animal](docs/Animal.md)
127128
- [Apple](docs/Apple.md)
128129
- [Banana](docs/Banana.md)
129130
- [Bar](docs/Bar.md)
130131
- [BarCreate](docs/BarCreate.md)
131132
- [BarRef](docs/BarRef.md)
132133
- [BarRefOrValue](docs/BarRefOrValue.md)
134+
- [Cat](docs/Cat.md)
135+
- [Dog](docs/Dog.md)
133136
- [Entity](docs/Entity.md)
134137
- [EntityRef](docs/EntityRef.md)
135138
- [Extensible](docs/Extensible.md)

samples/client/others/java/webclient-sealedInterface/api/openapi.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,19 @@ components:
266266
required:
267267
- length
268268
type: object
269+
Animal:
270+
oneOf:
271+
- $ref: "#/components/schemas/Dog"
272+
- $ref: "#/components/schemas/Cat"
273+
x-one-of-name: Animal
274+
Cat:
275+
properties:
276+
declawed:
277+
type: boolean
278+
type: object
279+
Dog:
280+
properties:
281+
bark:
282+
type: boolean
283+
type: object
269284

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
# Interface Animal
4+
5+
## Implementing Classes
6+
7+
* Cat
8+
* Dog
9+
10+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
# Cat
4+
5+
6+
## Properties
7+
8+
| Name | Type | Description | Notes |
9+
|------------ | ------------- | ------------- | -------------|
10+
|**declawed** | **Boolean** | | [optional] |
11+
12+
13+
## Implemented Interfaces
14+
15+
* Animal
16+
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
# Dog
4+
5+
6+
## Properties
7+
8+
| Name | Type | Description | Notes |
9+
|------------ | ------------- | ------------- | -------------|
10+
|**bark** | **Boolean** | | [optional] |
11+
12+
13+
## Implemented Interfaces
14+
15+
* Animal
16+
17+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* ByRefOrValue
3+
* This tests for a oneOf interface representation
4+
*
5+
* The version of the OpenAPI document: 0.0.1
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
package org.openapitools.client.model;
15+
16+
import java.util.Objects;
17+
import java.util.Arrays;
18+
import java.util.Locale;
19+
import com.fasterxml.jackson.annotation.JsonInclude;
20+
import com.fasterxml.jackson.annotation.JsonProperty;
21+
import com.fasterxml.jackson.annotation.JsonCreator;
22+
import com.fasterxml.jackson.annotation.JsonTypeName;
23+
import com.fasterxml.jackson.annotation.JsonValue;
24+
import org.openapitools.client.model.Cat;
25+
import org.openapitools.client.model.Dog;
26+
import com.fasterxml.jackson.annotation.JsonSubTypes;
27+
import com.fasterxml.jackson.annotation.JsonTypeInfo;
28+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
29+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
30+
import com.fasterxml.jackson.annotation.JsonTypeName;
31+
32+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")
33+
@JsonIgnoreProperties(
34+
value = "", // ignore manually set , it will be automatically generated by Jackson during serialization
35+
allowSetters = true // allows the to be set during deserialization
36+
)
37+
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "", visible = true)
38+
39+
public sealed interface Animal permits Dog, Cat {
40+
}
41+
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* ByRefOrValue
3+
* This tests for a oneOf interface representation
4+
*
5+
* The version of the OpenAPI document: 0.0.1
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
package org.openapitools.client.model;
15+
16+
import java.util.Objects;
17+
import java.util.Arrays;
18+
import java.util.Locale;
19+
import com.fasterxml.jackson.annotation.JsonInclude;
20+
import com.fasterxml.jackson.annotation.JsonProperty;
21+
import com.fasterxml.jackson.annotation.JsonCreator;
22+
import com.fasterxml.jackson.annotation.JsonTypeName;
23+
import com.fasterxml.jackson.annotation.JsonValue;
24+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
25+
import com.fasterxml.jackson.annotation.JsonTypeName;
26+
27+
/**
28+
* Cat
29+
*/
30+
@JsonPropertyOrder({
31+
Cat.JSON_PROPERTY_DECLAWED
32+
})
33+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")
34+
public final class Cat implements Animal {
35+
public static final String JSON_PROPERTY_DECLAWED = "declawed";
36+
@javax.annotation.Nullable
37+
private Boolean declawed;
38+
39+
public Cat() {
40+
}
41+
42+
public Cat declawed(@javax.annotation.Nullable Boolean declawed) {
43+
44+
this.declawed = declawed;
45+
return this;
46+
}
47+
48+
/**
49+
* Get declawed
50+
* @return declawed
51+
*/
52+
@javax.annotation.Nullable
53+
@JsonProperty(value = JSON_PROPERTY_DECLAWED, required = false)
54+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
55+
56+
public Boolean getDeclawed() {
57+
return declawed;
58+
}
59+
60+
61+
@JsonProperty(value = JSON_PROPERTY_DECLAWED, required = false)
62+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
63+
public void setDeclawed(@javax.annotation.Nullable Boolean declawed) {
64+
this.declawed = declawed;
65+
}
66+
67+
68+
@Override
69+
public boolean equals(Object o) {
70+
if (this == o) {
71+
return true;
72+
}
73+
if (o == null || getClass() != o.getClass()) {
74+
return false;
75+
}
76+
Cat cat = (Cat) o;
77+
return Objects.equals(this.declawed, cat.declawed);
78+
}
79+
80+
@Override
81+
public int hashCode() {
82+
return Objects.hash(declawed);
83+
}
84+
85+
@Override
86+
public String toString() {
87+
StringBuilder sb = new StringBuilder();
88+
sb.append("class Cat {\n");
89+
sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n");
90+
sb.append("}");
91+
return sb.toString();
92+
}
93+
94+
/**
95+
* Convert the given object to string with each line indented by 4 spaces
96+
* (except the first line).
97+
*/
98+
private String toIndentedString(Object o) {
99+
if (o == null) {
100+
return "null";
101+
}
102+
return o.toString().replace("\n", "\n ");
103+
}
104+
105+
}
106+
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* ByRefOrValue
3+
* This tests for a oneOf interface representation
4+
*
5+
* The version of the OpenAPI document: 0.0.1
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
package org.openapitools.client.model;
15+
16+
import java.util.Objects;
17+
import java.util.Arrays;
18+
import java.util.Locale;
19+
import com.fasterxml.jackson.annotation.JsonInclude;
20+
import com.fasterxml.jackson.annotation.JsonProperty;
21+
import com.fasterxml.jackson.annotation.JsonCreator;
22+
import com.fasterxml.jackson.annotation.JsonTypeName;
23+
import com.fasterxml.jackson.annotation.JsonValue;
24+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
25+
import com.fasterxml.jackson.annotation.JsonTypeName;
26+
27+
/**
28+
* Dog
29+
*/
30+
@JsonPropertyOrder({
31+
Dog.JSON_PROPERTY_BARK
32+
})
33+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")
34+
public final class Dog implements Animal {
35+
public static final String JSON_PROPERTY_BARK = "bark";
36+
@javax.annotation.Nullable
37+
private Boolean bark;
38+
39+
public Dog() {
40+
}
41+
42+
public Dog bark(@javax.annotation.Nullable Boolean bark) {
43+
44+
this.bark = bark;
45+
return this;
46+
}
47+
48+
/**
49+
* Get bark
50+
* @return bark
51+
*/
52+
@javax.annotation.Nullable
53+
@JsonProperty(value = JSON_PROPERTY_BARK, required = false)
54+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
55+
56+
public Boolean getBark() {
57+
return bark;
58+
}
59+
60+
61+
@JsonProperty(value = JSON_PROPERTY_BARK, required = false)
62+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
63+
public void setBark(@javax.annotation.Nullable Boolean bark) {
64+
this.bark = bark;
65+
}
66+
67+
68+
@Override
69+
public boolean equals(Object o) {
70+
if (this == o) {
71+
return true;
72+
}
73+
if (o == null || getClass() != o.getClass()) {
74+
return false;
75+
}
76+
Dog dog = (Dog) o;
77+
return Objects.equals(this.bark, dog.bark);
78+
}
79+
80+
@Override
81+
public int hashCode() {
82+
return Objects.hash(bark);
83+
}
84+
85+
@Override
86+
public String toString() {
87+
StringBuilder sb = new StringBuilder();
88+
sb.append("class Dog {\n");
89+
sb.append(" bark: ").append(toIndentedString(bark)).append("\n");
90+
sb.append("}");
91+
return sb.toString();
92+
}
93+
94+
/**
95+
* Convert the given object to string with each line indented by 4 spaces
96+
* (except the first line).
97+
*/
98+
private String toIndentedString(Object o) {
99+
if (o == null) {
100+
return "null";
101+
}
102+
return o.toString().replace("\n", "\n ");
103+
}
104+
105+
}
106+

0 commit comments

Comments
 (0)