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

Support for different coding keys for encoding / decoding the same property #60

Open
murad1981 opened this issue Jan 31, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@murad1981
Copy link

murad1981 commented Jan 31, 2024

Is there a way to decode a model's property key with a name and encode it using a different name ?
for ex. if have the following model:

@Codable
struct UserInfo {
 
@CodedAt("emailAddress")
  var email: String 
}

when I fetch the model from the api it returns the email field using the key name: "emailAddress" in the incoming json, but when I post the same model to a different api I want to use the name: "email" instead of "emailAddress"

@murad1981 murad1981 changed the title Support for different coding keys for encoding / decoding Support for different coding keys for the same property for encoding / decoding Jan 31, 2024
@murad1981 murad1981 changed the title Support for different coding keys for the same property for encoding / decoding Support for different coding keys for encoding / decoding the same property Jan 31, 2024
@soumyamahunt soumyamahunt added the enhancement New feature or request label Feb 9, 2024
@soumyamahunt soumyamahunt added the good first issue Good for newcomers label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants