Skip to content

Commit

Permalink
fix(specs): ingestion destination reject indexPrefix (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3478

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clément Vannicatte <[email protected]>
  • Loading branch information
algolia-bot and shortcuts committed Aug 5, 2024
1 parent b2c5dba commit 4881704
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 47 deletions.
39 changes: 0 additions & 39 deletions Sources/Ingestion/Models/DestinationIndexPrefix.swift

This file was deleted.

9 changes: 1 addition & 8 deletions Sources/Ingestion/Models/DestinationInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,19 @@ import Foundation
#endif

public enum DestinationInput: Codable, JSONEncodable, AbstractEncodable {
case destinationIndexPrefix(DestinationIndexPrefix)
case destinationIndexName(DestinationIndexName)

public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case let .destinationIndexPrefix(value):
try container.encode(value)
case let .destinationIndexName(value):
try container.encode(value)
}
}

public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
if let value = try? container.decode(DestinationIndexPrefix.self) {
self = .destinationIndexPrefix(value)
} else if let value = try? container.decode(DestinationIndexName.self) {
if let value = try? container.decode(DestinationIndexName.self) {
self = .destinationIndexName(value)
} else {
throw DecodingError.typeMismatch(
Expand All @@ -36,8 +31,6 @@ public enum DestinationInput: Codable, JSONEncodable, AbstractEncodable {

public func GetActualInstance() -> Encodable {
switch self {
case let .destinationIndexPrefix(value):
value as DestinationIndexPrefix
case let .destinationIndexName(value):
value as DestinationIndexName
}
Expand Down

0 comments on commit 4881704

Please sign in to comment.