Skip to content

Remove Microsoft.AspNetCore.WebUtilities dependency #419

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

Merged
merged 4 commits into from
Apr 20, 2020

Conversation

admilazz
Copy link
Contributor

@admilazz admilazz commented Apr 16, 2020

This change removes the Microsoft.AspNetCore.WebUtilities dependency (which pulls in several other unnecessary dependencies as well). The library was only used to manipulate query strings, but that can be done simply without it. Some minor bugs found in query-string handling were also fixed.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 16, 2020
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 16, 2020
@admilazz
Copy link
Contributor Author

/assign @krabhishek8260

<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.10" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" Condition="'$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'netcoreapp2.1'" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'" />
<PackageReference Include="YamlDotNet" Version="6.0.0" />
<PackageReference Include="System.Buffers" Version="4.5.1" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is one of the indirect dependencies pulled in by Microsoft.AspNetCore.WebUtilities, and it is being used.

@brendandburns
Copy link
Contributor

Please add a unit test for the query string generator then this is ready to merge.

{ "stdout", stdout ? "1": "0"},
{ "tty", tty ? "1": "0"}
}).TrimStart('?');
var query = new StringBuilder();
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer not to manipulate strings
Maybe copy the code from WebUtilities?

QueryHelpers is more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about if I:

  1. Call Utilities.AddQueryParameter for each line rather than using Append, or
  2. Add Utilities.AddQueryParameters which can taken multiple parameters, and use that?

@admilazz
Copy link
Contributor Author

admilazz commented Apr 16, 2020

Please add a unit test for the query string generator then this is ready to merge.

@brendandburns I tried to but I want to stop - or at least not contribute to - the exposure of implementation details publicly which I think is hampering changes to the client by making changes breaking when they really shouldn't be.

Is there some way to share internal types with the tests? Normally you use the [InternalsVisibleTo] attribute, but that requires a signed assembly. I remember seeing some comments about this in the past but I don't know where that went...

@admilazz
Copy link
Contributor Author

admilazz commented Apr 16, 2020

@brendandburns Okay, I added a test, which involved signing the test assembly so it can access the internals of the main client assembly.

Hopefully future implementation details can remain "internal" so they can change without needing a breaking API change.

@tg123
Copy link
Member

tg123 commented Apr 17, 2020

link #421
personally, I would prefer existing wheel instead of creating a new one.

@admilazz admilazz force-pushed the removeWebUtilities branch from 5daed62 to 4a440f2 Compare April 18, 2020 07:52
@admilazz
Copy link
Contributor Author

link #421
personally, I would prefer existing wheel instead of creating a new one.

Seems we made the same change at the same time. I merged in yours.

@brendandburns
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 20, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: admilazz, brendandburns

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 20, 2020
@k8s-ci-robot k8s-ci-robot merged commit f2e1c4b into kubernetes-client:master Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants