Skip to content

Commit

Permalink
fix(specs): ignorePlurals can be a boolean string (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3620

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Aug 30, 2024
1 parent 5e86151 commit 6645ccc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sources/Recommend/Models/RecommendBooleanString.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.

import Foundation
#if canImport(Core)
import Core
#endif

public enum RecommendBooleanString: String, Codable, CaseIterable {
case `true`
case `false`
}

extension RecommendBooleanString: Hashable {}
7 changes: 7 additions & 0 deletions Sources/Recommend/Models/RecommendIgnorePlurals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ import Foundation
/// languages used in your index.
public enum RecommendIgnorePlurals: Codable, JSONEncodable, AbstractEncodable {
case arrayOfRecommendSupportedLanguage([RecommendSupportedLanguage])
case recommendBooleanString(RecommendBooleanString)
case bool(Bool)

public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case let .arrayOfRecommendSupportedLanguage(value):
try container.encode(value)
case let .recommendBooleanString(value):
try container.encode(value)
case let .bool(value):
try container.encode(value)
}
Expand All @@ -26,6 +29,8 @@ public enum RecommendIgnorePlurals: Codable, JSONEncodable, AbstractEncodable {
let container = try decoder.singleValueContainer()
if let value = try? container.decode([RecommendSupportedLanguage].self) {
self = .arrayOfRecommendSupportedLanguage(value)
} else if let value = try? container.decode(RecommendBooleanString.self) {
self = .recommendBooleanString(value)
} else if let value = try? container.decode(Bool.self) {
self = .bool(value)
} else {
Expand All @@ -43,6 +48,8 @@ public enum RecommendIgnorePlurals: Codable, JSONEncodable, AbstractEncodable {
switch self {
case let .arrayOfRecommendSupportedLanguage(value):
value as [RecommendSupportedLanguage]
case let .recommendBooleanString(value):
value as RecommendBooleanString
case let .bool(value):
value as Bool
}
Expand Down
14 changes: 14 additions & 0 deletions Sources/Search/Models/SearchBooleanString.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.

import Foundation
#if canImport(Core)
import Core
#endif

public enum SearchBooleanString: String, Codable, CaseIterable {
case `true`
case `false`
}

extension SearchBooleanString: Hashable {}
7 changes: 7 additions & 0 deletions Sources/Search/Models/SearchIgnorePlurals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ import Foundation
/// languages used in your index.
public enum SearchIgnorePlurals: Codable, JSONEncodable, AbstractEncodable {
case arrayOfSearchSupportedLanguage([SearchSupportedLanguage])
case searchBooleanString(SearchBooleanString)
case bool(Bool)

public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case let .arrayOfSearchSupportedLanguage(value):
try container.encode(value)
case let .searchBooleanString(value):
try container.encode(value)
case let .bool(value):
try container.encode(value)
}
Expand All @@ -26,6 +29,8 @@ public enum SearchIgnorePlurals: Codable, JSONEncodable, AbstractEncodable {
let container = try decoder.singleValueContainer()
if let value = try? container.decode([SearchSupportedLanguage].self) {
self = .arrayOfSearchSupportedLanguage(value)
} else if let value = try? container.decode(SearchBooleanString.self) {
self = .searchBooleanString(value)
} else if let value = try? container.decode(Bool.self) {
self = .bool(value)
} else {
Expand All @@ -43,6 +48,8 @@ public enum SearchIgnorePlurals: Codable, JSONEncodable, AbstractEncodable {
switch self {
case let .arrayOfSearchSupportedLanguage(value):
value as [SearchSupportedLanguage]
case let .searchBooleanString(value):
value as SearchBooleanString
case let .bool(value):
value as Bool
}
Expand Down

0 comments on commit 6645ccc

Please sign in to comment.