Support generating Encodable types #728
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Support generating
Encodable
types:DataDict
conform toEncodable
Encodable
(there is no code to generate other than adding the protocol conformance) since the implementation is provided by an extension.Motivation
In some contexts, using the normalized cache adds a lot of overhead, including large cache size. When that's the case, it is desirable to be able to manage the persistence of Apollo types more directly, and Codable is the standard protocol to do so. This PR provides a solution for the serialization, and possibly for the deserialization when including
Apollo
as a dependency.Why not
Decodable
?I think types can be decoded from a JSON value using
which in my understanding has the benefit of going through all the Apollo machinery to validate the data, detect fragment conformance etc. If this understanding is correct this is great. However this code depends on
Apollo
, notApolloAPI
so this is not something the generated code can depend on.