Some properties on ShopifySharp.Order class should not be assignable
Some properties on ShopifySharp.Order are assignable, like, for example, Order.AppId, value for which can only be returned from the API call but not passed in.
Would it make sense to make such properties unassignable from user code?
Hey @petrechitashvili! I've thought about doing this as well. In general I don't think it's a bad idea, and it would hopefully prevent some confusion as to why some properties aren't being changed during updates or creation; we've had questions about that exact thing in the past.
I think the reason it was never implemented from the start is because Shopify used to be very poor at documenting their API, and it was rare for them to even document all of the properties on an object, let alone which ones were read only and which weren't.
They've certainly turned things around now though and the documentation is much better. However, it'd be a lot of work to go through all of the documentation and all of the classes to make the right properties read only. That's something I'd want to save for a 6.0 release I think!
Of course we'd have to make sure that the deserialization logic can set private properties because I don't think it is the case by default.
@nozzlegear I see your point and it makes sense, thanks for clarifying.
@clement911 I'd propose to use two separate classes for input and output and make it possible to convert between the two types. Does it make sense?
What do you think about separating Order class into SendOrder and ReceiveOrder?
I think this will add a lot of unnecessary boiler plate code. I think the right design to change the de-serializer so that it can populate private properties. I'm pretty sure it's not that hard to do with Json.NET (I think there is a setting for it).