Skip to content

Commit 539407e

Browse files
committed
chore: update samples
1 parent 6c73574 commit 539407e

174 files changed

Lines changed: 870 additions & 348 deletions

File tree

Some content is hidden

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

samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/StringEnumRef.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.fasterxml.jackson.annotation.JsonValue;
2626
import java.util.HashMap;
2727
import java.util.Map;
28-
import java.util.Optional;
2928

3029
/**
3130
* Gets or Sets StringEnumRef
@@ -67,7 +66,11 @@ public String toString() {
6766

6867
@JsonCreator
6968
public static StringEnumRef fromValue(String value) {
70-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
69+
StringEnumRef result = BY_VALUE.get(value);
70+
if (result != null) {
71+
return result;
72+
}
73+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
7174
}
7275

7376
/**

samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/StringEnumRef.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.google.gson.stream.JsonWriter;
2525
import java.util.HashMap;
2626
import java.util.Map;
27-
import java.util.Optional;
2827

2928
/**
3029
* Gets or Sets StringEnumRef
@@ -65,7 +64,11 @@ public String toString() {
6564
}
6665

6766
public static StringEnumRef fromValue(String value) {
68-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
67+
StringEnumRef result = BY_VALUE.get(value);
68+
if (result != null) {
69+
return result;
70+
}
71+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
6972
}
7073

7174
public static class Adapter extends TypeAdapter<StringEnumRef> {

samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/StringEnumRef.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import com.fasterxml.jackson.annotation.JsonValue;
2727
import java.util.HashMap;
2828
import java.util.Map;
29-
import java.util.Optional;
3029

3130
/**
3231
* Gets or Sets StringEnumRef
@@ -68,7 +67,11 @@ public String toString() {
6867

6968
@JsonCreator
7069
public static StringEnumRef fromValue(String value) {
71-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
70+
StringEnumRef result = BY_VALUE.get(value);
71+
if (result != null) {
72+
return result;
73+
}
74+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
7275
}
7376

7477
/**

samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/StringEnumRef.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.io.IOException;
2020
import java.util.HashMap;
2121
import java.util.Map;
22-
import java.util.Optional;
2322
import com.google.gson.TypeAdapter;
2423
import com.google.gson.JsonElement;
2524
import com.google.gson.annotations.JsonAdapter;
@@ -65,7 +64,11 @@ public String toString() {
6564
}
6665

6766
public static StringEnumRef fromValue(String value) {
68-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
67+
StringEnumRef result = BY_VALUE.get(value);
68+
if (result != null) {
69+
return result;
70+
}
71+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
6972
}
7073

7174
public static class Adapter extends TypeAdapter<StringEnumRef> {

samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/StringEnumRef.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.fasterxml.jackson.annotation.JsonValue;
2323
import java.util.HashMap;
2424
import java.util.Map;
25-
import java.util.Optional;
2625

2726
/**
2827
* Gets or Sets StringEnumRef
@@ -64,7 +63,11 @@ public String toString() {
6463

6564
@JsonCreator
6665
public static StringEnumRef fromValue(String value) {
67-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
66+
StringEnumRef result = BY_VALUE.get(value);
67+
if (result != null) {
68+
return result;
69+
}
70+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
6871
}
6972
}
7073

samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/model/StringEnumRef.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.fasterxml.jackson.annotation.JsonValue;
2323
import java.util.HashMap;
2424
import java.util.Map;
25-
import java.util.Optional;
2625

2726
/**
2827
* Gets or Sets StringEnumRef
@@ -64,7 +63,11 @@ public String toString() {
6463

6564
@JsonCreator
6665
public static StringEnumRef fromValue(String value) {
67-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
66+
StringEnumRef result = BY_VALUE.get(value);
67+
if (result != null) {
68+
return result;
69+
}
70+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
6871
}
6972
}
7073

samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/model/StringEnumRef.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.fasterxml.jackson.annotation.JsonValue;
2323
import java.util.HashMap;
2424
import java.util.Map;
25-
import java.util.Optional;
2625

2726
/**
2827
* Gets or Sets StringEnumRef
@@ -64,7 +63,11 @@ public String toString() {
6463

6564
@JsonCreator
6665
public static StringEnumRef fromValue(String value) {
67-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
66+
StringEnumRef result = BY_VALUE.get(value);
67+
if (result != null) {
68+
return result;
69+
}
70+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
6871
}
6972
}
7073

samples/client/others/java/restclient-enum-in-multipart/src/main/java/org/openapitools/client/model/DataChannel.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.fasterxml.jackson.annotation.JsonValue;
2323
import java.util.HashMap;
2424
import java.util.Map;
25-
import java.util.Optional;
2625

2726
/**
2827
* The transport-channel
@@ -66,7 +65,11 @@ public String toString() {
6665

6766
@JsonCreator
6867
public static DataChannel fromValue(String value) {
69-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
68+
DataChannel result = BY_VALUE.get(value);
69+
if (result != null) {
70+
return result;
71+
}
72+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
7073
}
7174
}
7275

samples/client/others/java/restclient-enum-in-multipart/src/main/java/org/openapitools/client/model/DataDirection.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.fasterxml.jackson.annotation.JsonValue;
2323
import java.util.HashMap;
2424
import java.util.Map;
25-
import java.util.Optional;
2625

2726
/**
2827
* The direction a message travels
@@ -62,7 +61,11 @@ public String toString() {
6261

6362
@JsonCreator
6463
public static DataDirection fromValue(String value) {
65-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
64+
DataDirection result = BY_VALUE.get(value);
65+
if (result != null) {
66+
return result;
67+
}
68+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
6669
}
6770
}
6871

samples/client/others/java/webclient-sealedInterface/src/main/java/org/openapitools/client/model/FruitType.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.fasterxml.jackson.annotation.JsonValue;
2323
import java.util.HashMap;
2424
import java.util.Map;
25-
import java.util.Optional;
2625

2726
/**
2827
* Gets or Sets FruitType
@@ -62,7 +61,11 @@ public String toString() {
6261

6362
@JsonCreator
6463
public static FruitType fromValue(String value) {
65-
return Optional.ofNullable(value).map(v -> BY_VALUE.get(v)).orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
64+
FruitType result = BY_VALUE.get(value);
65+
if (result != null) {
66+
return result;
67+
}
68+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
6669
}
6770
}
6871

0 commit comments

Comments
 (0)