Skip to content
This repository was archived by the owner on Apr 18, 2023. It is now read-only.

Conversation

@tobihagemann
Copy link

Fixes #27

As proposed in #27 (comment), this PR enhances the -[getSerializedDataWithError:] method in MSObject by recursively converting MSObjects to NSDictionary.

Since I have no idea how the models are actually generated, I didn't propose a solution that would make the dictionaries serializable from the get-go.

@msftclas
Copy link

msftclas commented Oct 8, 2019

CLA assistant check
All CLA requirements met.

@tritter
Copy link

tritter commented Jan 22, 2020

I also stumbled on this, but also fixed enum types thanks to the fix of @tobihagemann. He may first merges my branch: https://github.com/tritter/msgraph-sdk-objc-models

@tobihagemann
Copy link
Author

@tritter Done! Cherry-picked from your commits because I didn't want to merge unnecessary changes from master to my fix-27 branch.

Copy link

@liambolling liambolling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me

@S2V
Copy link

S2V commented Oct 22, 2020

Recursively convert to NSDictionary is missed - MS really? It looks like that should be released ASAP in the 1.3.1 version.

@S2V
Copy link

S2V commented Oct 30, 2020

@tobihagemann Also, I guess it should be correct to update the method getDictionary of the MSObject class to something like that:

-(NSMutableDictionary *)getDictionary
{
	return [[self recursivelyConvertObjectsToDictionariesInDictionary:self.dictionary] mutableCopy];
}

because the classes which inherit MSObject just put(set) the not serialized values into the mutable dictionary.

@tobihagemann
Copy link
Author

tobihagemann commented Oct 30, 2020

I haven't thought about this PR for a while now. You could be right but I have no idea what side-effects this would have. As I've stated in the beginning:

Since I have no idea how the models are actually generated, I didn't propose a solution that would make the dictionaries serializable from the get-go.

Edit: To be more specific, -[MSObject getDictionary] is a public method and the documentation just states that it returns the underlying dictionary. I guess that's what the method is currently doing. To improve that and to prevent breaking API changes, you would have to think about the side-effects of such a change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'Invalid type in JSON write (MSGraphEmailAddress)'

5 participants