Skip to content

Commit

Permalink
fix(specs): dictionary entry for stopwords has type property (generated)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
3 people committed Aug 5, 2024
1 parent d13f700 commit 05af6cd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import kotlinx.serialization.json.*
* @param words Matching words in the `plurals` dictionary including declensions.
* @param decomposition Invividual components of a compound word in the `compounds` dictionary.
* @param state
* @param type
*/
@Serializable(DictionaryEntrySerializer::class)
public data class DictionaryEntry(
Expand All @@ -36,6 +37,8 @@ public data class DictionaryEntry(

val state: DictionaryEntryState? = null,

val type: DictionaryEntryType? = null,

val additionalProperties: Map<String, JsonElement>? = null,
)

Expand All @@ -48,6 +51,7 @@ internal object DictionaryEntrySerializer : KSerializer<DictionaryEntry> {
element<List<String>>("words", isOptional = true)
element<List<String>>("decomposition", isOptional = true)
element<DictionaryEntryState>("state", isOptional = true)
element<DictionaryEntryType>("type", isOptional = true)
}

override fun deserialize(decoder: Decoder): DictionaryEntry {
Expand All @@ -60,6 +64,7 @@ internal object DictionaryEntrySerializer : KSerializer<DictionaryEntry> {
words = tree["words"]?.let { input.json.decodeFromJsonElement(it) },
decomposition = tree["decomposition"]?.let { input.json.decodeFromJsonElement(it) },
state = tree["state"]?.let { input.json.decodeFromJsonElement(it) },
type = tree["type"]?.let { input.json.decodeFromJsonElement(it) },
additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
)
}
Expand All @@ -73,6 +78,7 @@ internal object DictionaryEntrySerializer : KSerializer<DictionaryEntry> {
value.words?.let { put("words", output.json.encodeToJsonElement(it)) }
value.decomposition?.let { put("decomposition", output.json.encodeToJsonElement(it)) }
value.state?.let { put("state", output.json.encodeToJsonElement(it)) }
value.type?.let { put("type", output.json.encodeToJsonElement(it)) }
value.additionalProperties?.onEach { (key, element) -> put(key, element) }
}
(encoder as JsonEncoder).encodeJsonElement(json)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** 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. */
package com.algolia.client.model.search

import kotlinx.serialization.*

/**
* Whether a dictionary entry is provided by Algolia (standard), or has been added by you (custom).
*/
@Serializable
public enum class DictionaryEntryType(public val value: kotlin.String) {

@SerialName(value = "custom")
Custom("custom"),

@SerialName(value = "standard")
Standard("standard");

override fun toString(): kotlin.String = value
}

0 comments on commit 05af6cd

Please sign in to comment.