Replies: 2 comments 2 replies
-
Hi @mapitman - this has been on my "maybe" list for quite some time. ContextFirstly - it's definitely not on purpose. It's fair to say that I didn't start this library expecting to build full support for everything - I was just working on some Slack slash commands and wanted it to be a little easier. It....grew 😄 What this meant was that the objects at this stage are still based on the order I built them - when I built messages I was sending them, so they were a list. Views were something I expected to receive in events - so they were an array. Then I looked at modals and the Web API support was written (it came last) and now I was building Views - but the package had already gone through some big changes so I left them as it was. Future DesignOkay - so your actual question. Can we change it? Yes we can - v4.0 (it would be a breaking change - so a new major version) could update the models. So when I've thought about this before the rules would be
The only other thing is that I don't want to build objects that rely on custom contracts to send data out - so every list will need a Does that sound like it would work? |
Beta Was this translation helpful? Give feedback.
-
I pushed V4 this morning - there were a lot more arrays in the request objects than I had realised. I've also added to the Analyzers so that future changes are raised as a warning So now the project compiles checking for the following added rules 1. If a property is an array - a warning is raised unless it matches one of these conditions
There is a code fix added to the warning to convert the property to an 2. For
Code fixes are available for both these warnings too (they were well worth me writing them - made updating the library so much easier 😁 ) I could have written a contract resolver to handle the IList properties instead of lots of ShouldSerialize methods, but then anywhere there's serialization outside of the library you have to remember to add the contract and that's a no from me. |
Beta Was this translation helpful? Give feedback.
-
In most of the classes that have a
Blocks
property, it is anIList<IMessageBlock>
, however in theView
class it is an array. Is this by design or can we change it to a list?Slack.NetStandard/Slack.NetStandard/Messages/Message.cs
Line 18 in 4063c5c
Slack.NetStandard/Slack.NetStandard/Objects/View.cs
Line 36 in 4063c5c
Beta Was this translation helpful? Give feedback.
All reactions