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

Codable > Encodable | Decodable #168

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kalafus
Copy link
Contributor

@kalafus kalafus commented Feb 7, 2024

What

be specific with Codable:
use
Encodable for queries,
Decodable for results,
instead of Codable for everything

Why

accurate inheritance prevents accidental misuse

Affected Areas

JSON encoding and decoding during networking

NOTE

I don't know what to do with the .stub() functions, which require that Responses are Encodable for testing purposes, when Responses should only have to be Decodable.

@ingvarus-bc
Copy link
Contributor

Hey, @kalafus, thanks for your contribution! ✨
You're absolutely right about:

accurate inheritance prevents accidental misuse

It seems like tests here require some fixing now too 🙏🏼

@kalafus
Copy link
Contributor Author

kalafus commented Feb 15, 2024

had to add a surprising amount of code due to an error that extensions for the Encodable protocol won't automatically implement this way... but it's done. have any ideas to de-duplicate? there's got to be a better way!

Copy link

sonarcloud bot commented Feb 16, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
1.9% Duplication on New Code

See analysis details on SonarCloud

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

Successfully merging this pull request may close these issues.

None yet

2 participants