Skip to content

Commit 0ac26a6

Browse files
algolia-botkai687shortcuts
committed
fix(specs): dictionary entry for stopwords has type property (generated)
algolia/api-clients-automation#3456 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Kai Welke <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent a84bba0 commit 0ac26a6

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

Sources/Search/Models/DictionaryEntry.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,24 @@ public struct DictionaryEntry: Codable, JSONEncodable {
1818
/// Invividual components of a compound word in the `compounds` dictionary.
1919
public var decomposition: [String]?
2020
public var state: DictionaryEntryState?
21+
public var type: DictionaryEntryType?
2122

2223
public init(
2324
objectID: String,
2425
language: SearchSupportedLanguage? = nil,
2526
word: String? = nil,
2627
words: [String]? = nil,
2728
decomposition: [String]? = nil,
28-
state: DictionaryEntryState? = nil
29+
state: DictionaryEntryState? = nil,
30+
type: DictionaryEntryType? = nil
2931
) {
3032
self.objectID = objectID
3133
self.language = language
3234
self.word = word
3335
self.words = words
3436
self.decomposition = decomposition
3537
self.state = state
38+
self.type = type
3639
}
3740

3841
public enum CodingKeys: String, CodingKey, CaseIterable {
@@ -42,6 +45,7 @@ public struct DictionaryEntry: Codable, JSONEncodable {
4245
case words
4346
case decomposition
4447
case state
48+
case type
4549
}
4650

4751
public var additionalProperties: [String: AnyCodable] = [:]
@@ -74,9 +78,11 @@ public struct DictionaryEntry: Codable, JSONEncodable {
7478

7579
self.state = dictionary["state"]?.value as? DictionaryEntryState
7680

81+
self.type = dictionary["type"]?.value as? DictionaryEntryType
82+
7783
for (key, value) in dictionary {
7884
switch key {
79-
case "objectID", "language", "word", "words", "decomposition", "state":
85+
case "objectID", "language", "word", "words", "decomposition", "state", "type":
8086
continue
8187
default:
8288
self.additionalProperties[key] = value
@@ -94,6 +100,7 @@ public struct DictionaryEntry: Codable, JSONEncodable {
94100
try container.encodeIfPresent(self.words, forKey: .words)
95101
try container.encodeIfPresent(self.decomposition, forKey: .decomposition)
96102
try container.encodeIfPresent(self.state, forKey: .state)
103+
try container.encodeIfPresent(self.type, forKey: .type)
97104
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
98105
try additionalPropertiesContainer.encodeMap(self.additionalProperties)
99106
}
@@ -109,13 +116,15 @@ public struct DictionaryEntry: Codable, JSONEncodable {
109116
self.words = try container.decodeIfPresent([String].self, forKey: .words)
110117
self.decomposition = try container.decodeIfPresent([String].self, forKey: .decomposition)
111118
self.state = try container.decodeIfPresent(DictionaryEntryState.self, forKey: .state)
119+
self.type = try container.decodeIfPresent(DictionaryEntryType.self, forKey: .type)
112120
var nonAdditionalPropertyKeys = Set<String>()
113121
nonAdditionalPropertyKeys.insert("objectID")
114122
nonAdditionalPropertyKeys.insert("language")
115123
nonAdditionalPropertyKeys.insert("word")
116124
nonAdditionalPropertyKeys.insert("words")
117125
nonAdditionalPropertyKeys.insert("decomposition")
118126
nonAdditionalPropertyKeys.insert("state")
127+
nonAdditionalPropertyKeys.insert("type")
119128
let additionalPropertiesContainer = try decoder.container(keyedBy: String.self)
120129
self.additionalProperties = try additionalPropertiesContainer.decodeMap(
121130
AnyCodable.self,
@@ -131,7 +140,8 @@ extension DictionaryEntry: Equatable {
131140
lhs.word == rhs.word &&
132141
lhs.words == rhs.words &&
133142
lhs.decomposition == rhs.decomposition &&
134-
lhs.state == rhs.state
143+
lhs.state == rhs.state &&
144+
lhs.type == rhs.type
135145
&& lhs.additionalProperties == rhs.additionalProperties
136146
}
137147
}
@@ -144,6 +154,7 @@ extension DictionaryEntry: Hashable {
144154
hasher.combine(self.words?.hashValue)
145155
hasher.combine(self.decomposition?.hashValue)
146156
hasher.combine(self.state?.hashValue)
157+
hasher.combine(self.type?.hashValue)
147158
hasher.combine(self.additionalProperties.hashValue)
148159
}
149160
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
/// Whether a dictionary entry is provided by Algolia (standard), or has been added by you (custom).
10+
public enum DictionaryEntryType: String, Codable, CaseIterable {
11+
case custom
12+
case standard
13+
}
14+
15+
extension DictionaryEntryType: Hashable {}

0 commit comments

Comments
 (0)