speckleworks / SpeckleCore

Check a brand new Speckle at: https://github.com/specklesystems
https://speckle.systems
MIT License
38 stars 17 forks source link

Fix an issue with Attribute types. #97

Open logan12358 opened 5 years ago

logan12358 commented 5 years ago

I don't fully understand this. There doesn't seem to be a Type property on System.Attribute, so I don't know why it generally works at the moment. Deserialisation didn't work on iOS when compiled through Unity's IL2CPP, but it does with this fix.

I'm not set up to test this with the current Dynamo & Grasshopper builds, and that should probably happen before merging.

Generally, this file seems a bit magic & confusing. Feedback would be welcome.

didimitrie commented 5 years ago

Yep, that file is a legacy from back in the days. It is magic, as it was originally autogenerated code from nswag based on the swagger specs. Of course, magic had to be tinkered with, so there is some hard-coded stuff that makes it even more brittle.

In short, it just looks for the discriminator aptly named type (irony) and deserialises the json object into the right kind of speckle object.

I'll test with Gh and the rest as soon as i get the chance... We'll probably need to look at this closely in the near future.