Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The AllOfCodable implementation is wrong #9

Closed
haifengkao opened this issue Dec 14, 2024 · 2 comments
Closed

The AllOfCodable implementation is wrong #9

haifengkao opened this issue Dec 14, 2024 · 2 comments

Comments

@haifengkao
Copy link

haifengkao commented Dec 14, 2024

singleValueContainer does not have container.decodeIfPresent

                struct Example__testing__ {
                    let brand: Brand?
                    let company: Company
                    let omittedCompany: Company
                }

                extension Example__testing__: Decodable {
                    init(from decoder: Decoder) throws {
                        let container = try decoder.singleValueContainer()
                        self.brand = try container.decodeIfPresent(Brand.self)
                        self.company = try container.decode(Company.self)
                    }
                }
@mikhailmaslo
Copy link
Owner

Thank you for the bug reported, I will include this fix in the upcoming minor update

@mikhailmaslo
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants