Skip to content

[bug]: KeyedDecodingContainerProtocol public extension breaks decoding on other consumers. #876

@alladinian

Description

@alladinian

Description

Hi there,
just noticed the following issue after importing the AlgoliaSearchClient (Swift - iOS)

Our project relies (among others) to Firebase Firestore (it doesn't matter - but I include this information since many people I guess could be having the same combo).

After importing the search client I got a lot of decoding errors for types that conform to Decodable - specifically type mismatch errors for Decimal properties.

The errors indicated that a string was expected but got a number instead, which was strange (although it does make sense that a string value on DB would be the source for a Decimal) because the actual values on DB (Firestore) were numeric.

After stepping with a debugger I found out about the public extension KeyedDecodingContainerProtocol (Core > Helpers > Extensions) where implementations for Type specific cases were provided.

This is a major problem though because it builds on the assumption that Decimals are stored as strings...

Since this is a public extension, any target that imports the library inherits this problem.

Any ideas or workaround for this issue?

Client

Search

Version

9.14.0

Relevant log output

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions