Skip to content

Commit af89ed8

Browse files
authored
[swift5] Add Identifiable conformance to supported models (#20179)
1 parent a7cacce commit af89ed8

File tree

51 files changed

+164
-1
lines changed

Some content is hidden

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

51 files changed

+164
-1
lines changed

bin/configs/swift5-objcCompatible.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ templateDir: modules/openapi-generator/src/main/resources/swift5
55
generateAliasAsModel: true
66
additionalProperties:
77
podAuthors: ""
8+
identifiableModels: false
89
podSummary: PetstoreClient
910
objcCompatible: true
1011
projectName: PetstoreClient

docs/generators/swift5.md

+1

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java

+20
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
7070
public static final String USE_BACKTICK_ESCAPES = "useBacktickEscapes";
7171
public static final String GENERATE_MODEL_ADDITIONAL_PROPERTIES = "generateModelAdditionalProperties";
7272
public static final String HASHABLE_MODELS = "hashableModels";
73+
public static final String IDENTIFIABLE_MODELS = "identifiableModels";
7374
public static final String USE_JSON_ENCODABLE = "useJsonEncodable";
7475
public static final String MAP_FILE_BINARY_TO_DATA = "mapFileBinaryToData";
7576
public static final String USE_CUSTOM_DATE_WITHOUT_TIME = "useCustomDateWithoutTime";
@@ -95,6 +96,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
9596
@Setter protected boolean useBacktickEscapes = false;
9697
@Setter protected boolean generateModelAdditionalProperties = true;
9798
@Setter protected boolean hashableModels = true;
99+
@Setter protected boolean identifiableModels = true;
98100
@Setter protected boolean useJsonEncodable = true;
99101
@Getter @Setter
100102
protected boolean mapFileBinaryToData = false;
@@ -303,6 +305,10 @@ public Swift5ClientCodegen() {
303305
"Make hashable models (default: true)")
304306
.defaultValue(Boolean.TRUE.toString()));
305307

308+
cliOptions.add(new CliOption(IDENTIFIABLE_MODELS,
309+
"Make models conform to Identifiable when an id is present (default: true)")
310+
.defaultValue(Boolean.TRUE.toString()));
311+
306312
cliOptions.add(new CliOption(USE_JSON_ENCODABLE,
307313
"Make models conform to JSONEncodable protocol (default: true)")
308314
.defaultValue(Boolean.TRUE.toString()));
@@ -507,6 +513,11 @@ public void processOpts() {
507513
}
508514
additionalProperties.put(HASHABLE_MODELS, hashableModels);
509515

516+
if (additionalProperties.containsKey(IDENTIFIABLE_MODELS)) {
517+
setIdentifiableModels(convertPropertyToBooleanAndWriteBack(IDENTIFIABLE_MODELS));
518+
}
519+
additionalProperties.put(IDENTIFIABLE_MODELS, identifiableModels);
520+
510521
if (additionalProperties.containsKey(USE_JSON_ENCODABLE)) {
511522
setUseJsonEncodable(convertPropertyToBooleanAndWriteBack(USE_JSON_ENCODABLE));
512523
}
@@ -940,6 +951,15 @@ public CodegenModel fromModel(String name, Schema model) {
940951
if (hashableModels) {
941952
codegenModel.vendorExtensions.put("x-swift-hashable", true);
942953
}
954+
if (identifiableModels && !codegenModel.vendorExtensions.containsKey("x-swift-identifiable")) {
955+
for (CodegenProperty cp : codegenModel.getVars()) {
956+
if (!cp.getBaseName().equals("id")) continue;
957+
if (cp.isString || cp.isUuid || cp.isInteger || cp.isLong) {
958+
codegenModel.vendorExtensions.put("x-swift-identifiable", true);
959+
break;
960+
}
961+
}
962+
}
943963
return codegenModel;
944964
}
945965

modules/openapi-generator/src/main/resources/swift5/model.mustache

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ extension {{projectName}}API {
2727
{{> modelObject}}{{/isEnum}}{{/isArray}}{{/vendorExtensions.x-is-one-of-interface}}{{/model}}{{/models}}
2828
{{#swiftUseApiNamespace}}
2929
}
30-
{{/swiftUseApiNamespace}}
30+
{{/swiftUseApiNamespace}}{{#models}}{{#model}}{{#vendorExtensions.x-swift-identifiable}}
31+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
32+
extension {{#swiftUseApiNamespace}}{{projectName}}API.{{/swiftUseApiNamespace}}{{{classname}}}: Identifiable {}
33+
{{/vendorExtensions.x-swift-identifiable}}{{/model}}{{/models}}

modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class Swift5OptionsProvider implements OptionsProvider {
4747
public static final String USE_BACKTICKS_ESCAPES_VALUE = "false";
4848
public static final String GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE = "true";
4949
public static final String HASHABLE_MODELS_VALUE = "true";
50+
public static final String IDENTIFIABLE_MODELS_VALUE = "true";
5051
public static final String USE_JSON_ENCODABLE_VALUE = "true";
5152
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
5253
public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true";
@@ -94,6 +95,7 @@ public Map<String, String> createOptions() {
9495
.put(Swift5ClientCodegen.SWIFT_PACKAGE_PATH, SWIFT_PACKAGE_PATH_VALUE)
9596
.put(Swift5ClientCodegen.GENERATE_MODEL_ADDITIONAL_PROPERTIES, GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE)
9697
.put(Swift5ClientCodegen.HASHABLE_MODELS, HASHABLE_MODELS_VALUE)
98+
.put(Swift5ClientCodegen.IDENTIFIABLE_MODELS, IDENTIFIABLE_MODELS_VALUE)
9799
.put(Swift5ClientCodegen.USE_JSON_ENCODABLE, USE_JSON_ENCODABLE_VALUE)
98100
.put(Swift5ClientCodegen.MAP_FILE_BINARY_TO_DATA, "false")
99101
.put(Swift5ClientCodegen.USE_CUSTOM_DATE_WITHOUT_TIME, "false")

modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ protected void verifyOptions() {
4545
verify(clientCodegen).setResponseAs(Swift5OptionsProvider.RESPONSE_AS_VALUE.split(","));
4646
verify(clientCodegen).setNonPublicApi(Boolean.parseBoolean(Swift5OptionsProvider.NON_PUBLIC_API_REQUIRED_VALUE));
4747
verify(clientCodegen).setObjcCompatible(Boolean.parseBoolean(Swift5OptionsProvider.OBJC_COMPATIBLE_VALUE));
48+
verify(clientCodegen).setIdentifiableModels(Boolean.parseBoolean(Swift5OptionsProvider.IDENTIFIABLE_MODELS_VALUE));
4849
verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(Swift5OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE));
4950
verify(clientCodegen).setReadonlyProperties(Boolean.parseBoolean(Swift5OptionsProvider.READONLY_PROPERTIES_VALUE));
5051
verify(clientCodegen).setGenerateModelAdditionalProperties(Boolean.parseBoolean(Swift5OptionsProvider.GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE));

samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Category: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Category: Identifiable {}

samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift

+3
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ public struct Order: Codable, JSONEncodable, Hashable {
5656
}
5757
}
5858

59+
60+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
61+
extension Order: Identifiable {}

samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct Pet: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension Pet: Identifiable {}

samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Tag: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Tag: Identifiable {}

samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct User: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension User: Identifiable {}

samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Category: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Category: Identifiable {}

samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift

+3
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ public struct Order: Codable, JSONEncodable, Hashable {
5656
}
5757
}
5858

59+
60+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
61+
extension Order: Identifiable {}

samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct Pet: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension Pet: Identifiable {}

samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Tag: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Tag: Identifiable {}

samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct User: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension User: Identifiable {}

samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Category: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Category: Identifiable {}

samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift

+3
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ public struct Order: Codable, JSONEncodable, Hashable {
5656
}
5757
}
5858

59+
60+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
61+
extension Order: Identifiable {}

samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct Pet: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension Pet: Identifiable {}

samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Tag: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Tag: Identifiable {}

samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct User: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension User: Identifiable {}

samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Category: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Category: Identifiable {}

samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift

+3
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ public struct Order: Codable, JSONEncodable, Hashable {
5656
}
5757
}
5858

59+
60+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
61+
extension Order: Identifiable {}

samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift

+3
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ public struct Pet: Codable, JSONEncodable, Hashable {
5757
}
5858
}
5959

60+
61+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
62+
extension Pet: Identifiable {}

samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Tag: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Tag: Identifiable {}

samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct User: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension User: Identifiable {}

samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Category: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Category: Identifiable {}

samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift

+3
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ public struct Order: Codable, JSONEncodable, Hashable {
5656
}
5757
}
5858

59+
60+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
61+
extension Order: Identifiable {}

samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct Pet: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension Pet: Identifiable {}

samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Tag: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Tag: Identifiable {}

samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct User: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension User: Identifiable {}

samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ internal struct Category: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Category: Identifiable {}

samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift

+3
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ internal struct Order: Codable, JSONEncodable {
5757
}
5858
}
5959

60+
61+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
62+
extension Order: Identifiable {}

samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift

+3
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,6 @@ internal struct Pet: Codable, JSONEncodable, Hashable {
6060
}
6161
}
6262

63+
64+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
65+
extension Pet: Identifiable {}

samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ internal struct Tag: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Tag: Identifiable {}

samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ internal struct User: Codable, JSONEncodable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension User: Identifiable {}

samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Category: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Category: Identifiable {}

samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift

+3
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ public struct Order: Codable, JSONEncodable, Hashable {
5656
}
5757
}
5858

59+
60+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
61+
extension Order: Identifiable {}

samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct Pet: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension Pet: Identifiable {}

samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ public struct Tag: Codable, JSONEncodable, Hashable {
3434
}
3535
}
3636

37+
38+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
39+
extension Tag: Identifiable {}

samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ public struct User: Codable, JSONEncodable, Hashable {
5959
}
6060
}
6161

62+
63+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
64+
extension User: Identifiable {}

samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift

+3
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ public final class Category: Codable, JSONEncodable, Hashable {
5252
}
5353

5454
}
55+
56+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
57+
extension PetstoreClientAPI.Category: Identifiable {}

samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift

+3
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,6 @@ public final class Order: Codable, JSONEncodable, Hashable {
8282
}
8383

8484
}
85+
86+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
87+
extension PetstoreClientAPI.Order: Identifiable {}

samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift

+3
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,6 @@ public final class Pet: Codable, JSONEncodable, Hashable {
8585
}
8686

8787
}
88+
89+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
90+
extension PetstoreClientAPI.Pet: Identifiable {}

samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift

+3
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ public final class Tag: Codable, JSONEncodable, Hashable {
5252
}
5353

5454
}
55+
56+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
57+
extension PetstoreClientAPI.Tag: Identifiable {}

samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift

+3
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,6 @@ public final class User: Codable, JSONEncodable, Hashable {
8989
}
9090

9191
}
92+
93+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
94+
extension PetstoreClientAPI.User: Identifiable {}

samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/Category.swift

+3
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ public final class Category: Content, Hashable {
4747
}
4848
}
4949

50+
51+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
52+
extension Category: Identifiable {}

samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/Order.swift

+3
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,6 @@ public final class Order: Content, Hashable {
7777
}
7878
}
7979

80+
81+
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
82+
extension Order: Identifiable {}

0 commit comments

Comments
 (0)