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

Remove Codable conformance for request or response-only types #34

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

andrewheard
Copy link
Collaborator

  • Conform to Encodable for request-only types
  • Conform to Decodable for response-only types

In some cases, you may not need Codable's support for bidirectional encoding and decoding. For example, some apps only need to make calls to a remote network API and do not need to decode a response containing the same type. Declare conformance to Encodable if you only need to support the encoding of data. Conversely, declare conformance to Decodable if you only need to read data of a given type.

-- https://developer.apple.com/documentation/foundation/archives_and_serialization/encoding_and_decoding_custom_types#2904056

Context: It's easier to add Codable conformance to our public API contract later, if needed, than to remove it if not needed.

@github-actions github-actions bot added component:swift sdk Issue/PR related to Swift SDK status:awaiting review PR awaiting review from a maintainer labels Dec 12, 2023
@andrewheard andrewheard merged commit b21147f into main Dec 12, 2023
8 checks passed
@andrewheard andrewheard deleted the ah/codable-conformance branch December 12, 2023 16:30
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:swift sdk Issue/PR related to Swift SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants