-
-
Notifications
You must be signed in to change notification settings - Fork 39
Description
- I have read the documentation.
- I have read the limitations.
- I could not find my request.
- I have tried implementing this request with
HelperCoder
.
Is your feature request related to a problem? Please describe.
In our codebase, we frequently separate request and response models, meaning we often need types that are only Encodable or only Decodable.
However, when using @Codable
, both conformance implementations are generated, even when unnecessary. This can lead to unwanted behavior and redundant code.
Describe the solution you'd like
I’d love to see support for @Encodable
and @Decodable
as standalone macros alongside @Codable
.
This would allow developers to precisely specify what kind of Codable behavior they need, and better reflect intended use.
Describe alternatives you've considered
One potential workaround is applying @IgnoreEncoding (or @IgnoreDecoding) to every property.
While this may prevent macro-generated errors, it still results in the type conforming to Encodable (or Decodable) unnecessarily—especially in cases like response models, where encoding should never happen.
So while technically feasible, this feels like a workaround rather than a proper solution.