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

Primary key not required #115

Open
jcavar opened this issue Aug 16, 2018 · 4 comments
Open

Primary key not required #115

jcavar opened this issue Aug 16, 2018 · 4 comments

Comments

@jcavar
Copy link
Contributor

jcavar commented Aug 16, 2018

Hello!

I understand data validation is more of general concern and maybe out of scope for this librarty. There were also few questions asked before, however I am interested specifically about primaryKey attribute.

If you specify it for your mapping, does it make sense to create object when not in representation? At the moment framework just checks and if not in, it ignores it, but it sounds to me like this should result in error (or nil).

What are your thoughts?

@jcavar jcavar changed the title Primary key required Primary key not required Aug 16, 2018
@dimazen
Copy link
Contributor

dimazen commented Aug 16, 2018

Good day, @jcavar!
Can you describe some real use case, because I don't fully understand what you mean by

just checks and if not in, it ignores it

Thanks!

@jcavar
Copy link
Contributor Author

jcavar commented Aug 17, 2018

If we get invalid data without identifier, FEM inserts object without identifier.

What I meant by that is this part of code:

https://github.com/Yalantis/FastEasyMapping/blob/master/FastEasyMapping/Source/Deserializer/FEMDeserializer.m#L120-L122

My feeling is that there should be else case where you return nil.

@dimazen
Copy link
Contributor

dimazen commented Aug 17, 2018

@jcavar oh, I got it. Can you check out branch required-pk? Will it help if you gonna use this version? If so, I'll roll out a release

@jcavar
Copy link
Contributor Author

jcavar commented Aug 17, 2018

That looks like it, yes!

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

No branches or pull requests

2 participants