-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix #484: Use IEnumerable<T> instead of IList<T>. #485
Fix #484: Use IEnumerable<T> instead of IList<T>. #485
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed and observed the changes.
@rossmills99 Is this release's Nuget package available? |
@@ -9,14 +9,14 @@ namespace ArangoDBNetStandard.AqlFunctionApi.Models | |||
public class PostExplainAqlQueryResponseNode | |||
{ | |||
public string Type { get; set; } | |||
public IList<int> Dependencies { get; set; } | |||
public IEnumerable<int> Dependencies { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand, this is a breaking change. Any change from IList<T>
to IEnumerable<T>
in response models is a breaking change. (e.g. see the tests updates, Count
to Count()
).
The following code won't compile after the changes:
IList<string> projections = response.Projections; // CS0266 error
var projections = response.Projections;
// Anyting using IList<T> methods will cause errors, e.g. CS0021.
❓ Is it on purpose?
It's mostly beneficial for us, the library developers (or for customer implementation of serialization), to use IEnumerable<T>
in response models, as we can change the implementation without breaking existing code. But honestly, I don't think it's worth introducing a breaking change, though it's a fairly minor one.
❓ Should we revert the change for response model and schedule it in a major release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using IList seems to have been a strange choice which got repeated in several places - not sure why it was used in the first place. But yes you're right to point out this is a breaking change. Happy to see this change be reverted, or alternatively we just treat it as a breaking change and bump the version per semantic versioning? i.e. why do we need to "schedule" something, we can just bump the version with this change, if it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using IList seems to have been a strange choice which got repeated in several places - not sure why it was used in the first place.
Not sure. If I had to guess, it's because IList<T>
has a fixed Count
property and the serializer uses List<T>
. I agree that IEnumerable<T>
is generally better, and callers can use .ToList()
if they want a list.
Happy to see this change be reverted, or alternatively we just treat it as a breaking change and bump the version per semantic versioning? i.e. why do we need to "schedule" something, we can just bump the version with this change, if it makes sense.
I find it best to group breaking changes together and separate them from smaller enhancements. If someone updates to use the enhancements, they probably don't want to deal with breaking changes.
But yes, we can just bump the version. Were you thinking of bumping from 2.0.2 to 2.1.0 or 3.0.0? To follow the semantic versioning rules, we must bump to 3.0.0 but it makes it seem like a bigger update than it is.
I am working on #481 that we could release together before Christmas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semantic versioning doesn't say anything about the size of the update, so bumping to 3.0 should be fine I think.
Hey @Arash-Sabet , I would like to clarify the questions above with @rossmills99 before releasing this enhancement. We can get it out once done 👍 Depending on the outcome, it will be in a patch release, 2.0.2 or minor release 2.1.0 |
Hey @rossmills99 & @DiscoPYF Do you happen to know when you're planning to release the patch or minor release as the enhancements in our side are pending for your changes. |
Per discussion above we can release as 3.0.0 along with a couple of other recently added improvements. I can prepare a release to go out today. |
@rossmills99 thanks for the prompt action. |
No problem, thanks for the prompt 😄 The 3.0.0 package is now published in Nuget, you can view release notes here: https://github.com/ArangoDB-Community/arangodb-net-standard/releases/tag/3.0.0 |
Fix #484 by using IEnumerable in place of IList.
I've ended up expanding from the issue description to also update all places we used IList in interfaces and models.
As far as I can tell, this should not be a breaking change because every
IList<T>
is already anIEnumerable<T>
, butIEnumerable<T>
allows for greater flexibility in choice of the actual collection type implementations used.