dotnet / Docker.DotNet

:whale: .NET (C#) Client Library for Docker API
https://www.nuget.org/packages/Docker.DotNet/
MIT License
2.23k stars 381 forks source link

Any plan for System.Text.Json? #653

Open 7amou3 opened 1 year ago

7amou3 commented 1 year ago

Hello Thank you guys for this awesome library

I would like to know if there is any plan to drop the Newtonjson serializer, and use the System.Text.Json? Another idea would be to move the serializers outside the core project, and let the user choose which serializer to include, example if I want to work with System.text.json I would import 2 packages: Docker.DotNet and Docker.DotNet.Text.Json.

Why? 1- The NewtonJson - Although it was a great library - will not support Aot 2- Remove a hard dependency from the core project 3- Performance of the System.Text...

NCLnclNCL commented 1 year ago

mee too

lukewis commented 11 months ago

Lack of AOT support is a deal breaker for me. I had to resort to writing my own implementation.

galvesribeiro commented 11 months ago

Hey! Sorry for the delay.

Although it is going slowly (slower than I would like tbh), I'm working on a full refactory of the library behind the scenes. I've made good progress but it is not ready for prime time yet as I need to be very careful. I understand many other projects have dependencies on this library and this next one will potentially be a breaking change so I have to make it worth.

This refactory, among other things, aims to:

  1. Update everything to latest .Net
  2. Drop JSON.Net and use System.Text.Json with Source Generators - Since the Docker APIs use JSON for serialization, it makes not much sense to have multiple JSON serializers and since STJ is miles away faster than JSON.Net and has Roslyn Source Generators for the serializers, I'm sticking to it. The fact that all serializers will be source generated means that there is not reflection, so it is out of the box AoT friendly
  3. Drop the handmade Go model generator - The new version uses Roslyn source generator on top of the publicly available Docker API Swagger schema. That way we don't need to be tied anymore to the Go source code and make updates to the library stupid simple

I maybe will have a preview version before the .Net Conf. Will see.

Thanks for the interest and support, I'll keep everyone updated once I have more to share.

lukewis commented 11 months ago

That sounds fabulous. I appreciate the update and hard work!

7amou3 commented 10 months ago

@galvesribeiro can you share the repository please? even if it's not ready yet

kanpov commented 2 months ago

Honestly, I think a better route would be to bind to Podman's libpod API and transition away from using Docker whatsoever, as Docker has been lagging behind as a container runtime. The API in question

The fact this project hasn't had commits for over a year only adds to my concern. Quite disappointing for an "official" .NET project that Testcontainers relies on (=is blocked by).

galvesribeiro commented 2 months ago

@kanpov Docker is not going anywhere tbh. Yes, it is slow moving than other newcomer libraries.

I thought however, on having (after the revamp on Docker.DotNet) other container runtime library support like for example, containerd, maybe podman. Perhaps rebranding Docker.DotNet to Container.DotNet. I'll discuss with others and perhaps open a pool somewhere to see if this would be a good idea but first, need to finish the revamp the current library.