diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ed492ddc..2c003f0e 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -4,7 +4,7 @@ true - netstandard2.0;netstandard2.1 + net6.0 latest https://camo.githubusercontent.com/fa6d5c12609ed8a3ba1163b96f9e9979b8f59b0d/687474703a2f2f7765732e696f2f566663732f636f6e74656e74 Copyright (c) .NET Foundation and Contributors diff --git a/src/Docker.DotNet/Docker.DotNet.csproj b/src/Docker.DotNet/Docker.DotNet.csproj index 14b531e2..a2bf1720 100644 --- a/src/Docker.DotNet/Docker.DotNet.csproj +++ b/src/Docker.DotNet/Docker.DotNet.csproj @@ -8,6 +8,6 @@ - + \ No newline at end of file diff --git a/src/Docker.DotNet/DockerDotnetJsonSerializerContext.Generated.cs b/src/Docker.DotNet/DockerDotnetJsonSerializerContext.Generated.cs new file mode 100644 index 00000000..d2016443 --- /dev/null +++ b/src/Docker.DotNet/DockerDotnetJsonSerializerContext.Generated.cs @@ -0,0 +1,762 @@ +// + +using Docker.DotNet.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; + +using Version = Docker.DotNet.Models.Version; + +namespace Docker.DotNet; + +[JsonSerializable(typeof(Privileges))] +[JsonSerializable(typeof(ContainerListResponse))] +[JsonSerializable(typeof(IndexInfo))] +[JsonSerializable(typeof(ImagesCreateParameters))] +[JsonSerializable(typeof(Spec))] +[JsonSerializable(typeof(ImagePushParameters))] +[JsonSerializable(typeof(RaftConfig))] +[JsonSerializable(typeof(ComponentVersion))] +[JsonSerializable(typeof(SecretSpec))] +[JsonSerializable(typeof(ContainerRestartParameters))] +[JsonSerializable(typeof(Health))] +[JsonSerializable(typeof(VolumesPruneParameters))] +[JsonSerializable(typeof(NodeUpdateParameters))] +[JsonSerializable(typeof(Commit))] +[JsonSerializable(typeof(PluginConfigNetwork))] +[JsonSerializable(typeof(ContainerSpec))] +[JsonSerializable(typeof(TmpfsOptions))] +[JsonSerializable(typeof(ServicesListParameters))] +[JsonSerializable(typeof(ServiceFilter))] +[JsonSerializable(typeof(ServiceCreationMode))] +[JsonSerializable(typeof(WeightDevice))] +[JsonSerializable(typeof(NetworksListParameters))] +[JsonSerializable(typeof(BlkioStats))] +[JsonSerializable(typeof(ContainersPruneResponse))] +[JsonSerializable(typeof(SwarmLimit))] +[JsonSerializable(typeof(ImageDeleteParameters))] +[JsonSerializable(typeof(PortStatus))] +[JsonSerializable(typeof(EndpointIPAMConfig))] +[JsonSerializable(typeof(ContainerStopParameters))] +[JsonSerializable(typeof(Runtime))] +[JsonSerializable(typeof(SwarmLeaveParameters))] +[JsonSerializable(typeof(IPAMConfig))] +[JsonSerializable(typeof(ThrottleDevice))] +[JsonSerializable(typeof(NetworkConnectParameters))] +[JsonSerializable(typeof(HealthcheckResult))] +[JsonSerializable(typeof(SecretCreateResponse))] +[JsonSerializable(typeof(SwarmJoinParameters))] +[JsonSerializable(typeof(NetworkAddressPool))] +[JsonSerializable(typeof(ImageDeleteResponse))] +[JsonSerializable(typeof(ContainerRemoveParameters))] +[JsonSerializable(typeof(VersionResponse))] +[JsonSerializable(typeof(DispatcherConfig))] +[JsonSerializable(typeof(ContainersPruneParameters))] +[JsonSerializable(typeof(DNSConfig))] +[JsonSerializable(typeof(Driver))] +[JsonSerializable(typeof(NetworkSettings))] +[JsonSerializable(typeof(NetworkSpec))] +[JsonSerializable(typeof(PluginEnv))] +[JsonSerializable(typeof(ImageTagParameters))] +[JsonSerializable(typeof(ImagesListResponse))] +[JsonSerializable(typeof(ServiceListParameters))] +[JsonSerializable(typeof(ShimConfig))] +[JsonSerializable(typeof(ReplicatedService))] +[JsonSerializable(typeof(PortBinding))] +[JsonSerializable(typeof(CAConfig))] +[JsonSerializable(typeof(EndpointResource))] +[JsonSerializable(typeof(PluginSpec))] +[JsonSerializable(typeof(UsageData))] +[JsonSerializable(typeof(ImageBuildResponse))] +[JsonSerializable(typeof(ServiceMode))] +[JsonSerializable(typeof(CredentialSpec))] +[JsonSerializable(typeof(StorageStats))] +[JsonSerializable(typeof(Stats))] +[JsonSerializable(typeof(ContainerListProcessesParameters))] +[JsonSerializable(typeof(PluginRemoveParameters))] +[JsonSerializable(typeof(NetworkTask))] +[JsonSerializable(typeof(ImageSearchResponse))] +[JsonSerializable(typeof(ClusterOptions))] +[JsonSerializable(typeof(ContainerStatus))] +[JsonSerializable(typeof(UpdateStatus))] +[JsonSerializable(typeof(MemoryStats))] +[JsonSerializable(typeof(CommitContainerChangesResponse))] +[JsonSerializable(typeof(GenericResource))] +[JsonSerializable(typeof(Message))] +[JsonSerializable(typeof(JSONMessage))] +[JsonSerializable(typeof(ServiceInfo))] +[JsonSerializable(typeof(ClusterVolumeSpec))] +[JsonSerializable(typeof(TaskStatus))] +[JsonSerializable(typeof(ClusterVolume))] +[JsonSerializable(typeof(JobStatus))] +[JsonSerializable(typeof(VolumesListParameters))] +[JsonSerializable(typeof(VolumesListResponse))] +[JsonSerializable(typeof(ImagesSearchParameters))] +[JsonSerializable(typeof(Plugin))] +[JsonSerializable(typeof(PluginSettings))] +[JsonSerializable(typeof(TopologyRequirement))] +[JsonSerializable(typeof(TaskSpec))] +[JsonSerializable(typeof(ContainerStatsResponse))] +[JsonSerializable(typeof(NetworkResponse))] +[JsonSerializable(typeof(EndpointSettings))] +[JsonSerializable(typeof(RootFS))] +[JsonSerializable(typeof(EndpointVirtualIP))] +[JsonSerializable(typeof(PluginPrivilege))] +[JsonSerializable(typeof(AuthResponse))] +[JsonSerializable(typeof(VolumeOptions))] +[JsonSerializable(typeof(TypeMount))] +[JsonSerializable(typeof(CPUUsage))] +[JsonSerializable(typeof(TypeBlock))] +[JsonSerializable(typeof(NodeListResponse))] +[JsonSerializable(typeof(PortConfig))] +[JsonSerializable(typeof(Address))] +[JsonSerializable(typeof(SwarmConfigSpec))] +[JsonSerializable(typeof(BlkioStatEntry))] +[JsonSerializable(typeof(CreateContainerResponse))] +[JsonSerializable(typeof(ContainerExecStartParameters))] +[JsonSerializable(typeof(SummaryNetworkSettings))] +[JsonSerializable(typeof(ImageInspectResponse))] +[JsonSerializable(typeof(GlobalJob))] +[JsonSerializable(typeof(ContainerNode))] +[JsonSerializable(typeof(Port))] +[JsonSerializable(typeof(ImageInspectParameters))] +[JsonSerializable(typeof(ContainerPathStatParameters))] +[JsonSerializable(typeof(Topology))] +[JsonSerializable(typeof(NetworkAttachmentConfig))] +[JsonSerializable(typeof(PluginInstallParameters))] +[JsonSerializable(typeof(VolumesCreateParameters))] +[JsonSerializable(typeof(GetArchiveFromContainerResponse))] +[JsonSerializable(typeof(PeerInfo))] +[JsonSerializable(typeof(Platform))] +[JsonSerializable(typeof(SwarmUpdateParameters))] +[JsonSerializable(typeof(SwarmUpdateConfigParameters))] +[JsonSerializable(typeof(PluginConfigUser))] +[JsonSerializable(typeof(ConfigReference))] +[JsonSerializable(typeof(ContainerPathStatResponse))] +[JsonSerializable(typeof(DiscreteGenericResource))] +[JsonSerializable(typeof(ContainerWaitResponse))] +[JsonSerializable(typeof(Version))] +[JsonSerializable(typeof(GetArchiveFromContainerParameters))] +[JsonSerializable(typeof(ContainerKillParameters))] +[JsonSerializable(typeof(SwarmInitParameters))] +[JsonSerializable(typeof(ContainerInspectParameters))] +[JsonSerializable(typeof(AuthConfig))] +[JsonSerializable(typeof(ServiceLogsParameters))] +[JsonSerializable(typeof(TLSInfo))] +[JsonSerializable(typeof(Annotations))] +[JsonSerializable(typeof(Mount))] +[JsonSerializable(typeof(UpdateConfig))] +[JsonSerializable(typeof(ContainerStartParameters))] +[JsonSerializable(typeof(ContainerLogsParameters))] +[JsonSerializable(typeof(ContainersListParameters))] +[JsonSerializable(typeof(SwarmDriver))] +[JsonSerializable(typeof(PluginConfigRootfs))] +[JsonSerializable(typeof(EngineDescription))] +[JsonSerializable(typeof(VolumeInfo))] +[JsonSerializable(typeof(VolumeAttachment))] +[JsonSerializable(typeof(NodeRemoveParameters))] +[JsonSerializable(typeof(PluginsInfo))] +[JsonSerializable(typeof(ExternalCA))] +[JsonSerializable(typeof(ConfigReferenceFileTarget))] +[JsonSerializable(typeof(RestartPolicy))] +[JsonSerializable(typeof(SELinuxContext))] +[JsonSerializable(typeof(ServiceUpdateResponse))] +[JsonSerializable(typeof(TaskState))] +[JsonSerializable(typeof(Endpoint))] +[JsonSerializable(typeof(PluginDisableParameters))] +[JsonSerializable(typeof(NetworksCreateParameters))] +[JsonSerializable(typeof(ServiceCreateResponse))] +[JsonSerializable(typeof(ContainerFileSystemChangeResponse))] +[JsonSerializable(typeof(ImagesLoadResponse))] +[JsonSerializable(typeof(NetworkingConfig))] +[JsonSerializable(typeof(JSONProgress))] +[JsonSerializable(typeof(ContainerAttachParameters))] +[JsonSerializable(typeof(SwarmInspectResponse))] +[JsonSerializable(typeof(ContainerUpdateResponse))] +[JsonSerializable(typeof(NetworkAttachment))] +[JsonSerializable(typeof(AccessMode))] +[JsonSerializable(typeof(PluginUpgradeParameters))] +[JsonSerializable(typeof(ContainerExecCreateResponse))] +[JsonSerializable(typeof(SwarmCreateConfigParameters))] +[JsonSerializable(typeof(VolumeSecret))] +[JsonSerializable(typeof(ServiceStatus))] +[JsonSerializable(typeof(FileSystemChangeKind))] +[JsonSerializable(typeof(Placement))] +[JsonSerializable(typeof(PluginGetPrivilegeParameters))] +[JsonSerializable(typeof(BindOptions))] +[JsonSerializable(typeof(SystemInfoResponse))] +[JsonSerializable(typeof(DeviceMapping))] +[JsonSerializable(typeof(JoinTokens))] +[JsonSerializable(typeof(Ulimit))] +[JsonSerializable(typeof(NetworkStats))] +[JsonSerializable(typeof(ContainerStatsParameters))] +[JsonSerializable(typeof(ClusterInfo))] +[JsonSerializable(typeof(ImageHistoryResponse))] +[JsonSerializable(typeof(SwarmUnlockResponse))] +[JsonSerializable(typeof(Secret))] +[JsonSerializable(typeof(GraphDriverData))] +[JsonSerializable(typeof(SwarmIPAMConfig))] +[JsonSerializable(typeof(PluginConfigureParameters))] +[JsonSerializable(typeof(Resources))] +[JsonSerializable(typeof(DefaultNetworkSettings))] +[JsonSerializable(typeof(NodeStatus))] +[JsonSerializable(typeof(Config))] +[JsonSerializable(typeof(PidsStats))] +[JsonSerializable(typeof(SwarmUnlockParameters))] +[JsonSerializable(typeof(PluginDevice))] +[JsonSerializable(typeof(ImagesPruneParameters))] +[JsonSerializable(typeof(LogConfig))] +[JsonSerializable(typeof(ResourceRequirements))] +[JsonSerializable(typeof(CommitContainerChangesParameters))] +[JsonSerializable(typeof(RestartPolicyKind))] +[JsonSerializable(typeof(PublishStatus))] +[JsonSerializable(typeof(SwarmConfigReference))] +[JsonSerializable(typeof(IPAM))] +[JsonSerializable(typeof(NetworkSettingsBase))] +[JsonSerializable(typeof(PluginConfigLinux))] +[JsonSerializable(typeof(SpreadOver))] +[JsonSerializable(typeof(VolumeTopology))] +[JsonSerializable(typeof(ManagerStatus))] +[JsonSerializable(typeof(SecretReference))] +[JsonSerializable(typeof(PluginListParameters))] +[JsonSerializable(typeof(HealthConfig))] +[JsonSerializable(typeof(ImageMetadata))] +[JsonSerializable(typeof(ContainerUpdateParameters))] +[JsonSerializable(typeof(IPAMOptions))] +[JsonSerializable(typeof(SwarmResources))] +[JsonSerializable(typeof(OrchestrationConfig))] +[JsonSerializable(typeof(CPUStats))] +[JsonSerializable(typeof(CreateContainerParameters))] +[JsonSerializable(typeof(PluginConfigInterface))] +[JsonSerializable(typeof(Meta))] +[JsonSerializable(typeof(NetworksCreateResponse))] +[JsonSerializable(typeof(RuntimePluginPrivilege))] +[JsonSerializable(typeof(NetworksDeleteUnusedParameters))] +[JsonSerializable(typeof(ServiceCreateParameters))] +[JsonSerializable(typeof(Peer))] +[JsonSerializable(typeof(ContainerState))] +[JsonSerializable(typeof(GlobalService))] +[JsonSerializable(typeof(ServiceSpec))] +[JsonSerializable(typeof(ServiceUpdateParameters))] +[JsonSerializable(typeof(ContainerProcessesResponse))] +[JsonSerializable(typeof(ConfigReferenceRuntimeTarget))] +[JsonSerializable(typeof(ContainerExecInspectResponse))] +[JsonSerializable(typeof(NetworkDisconnectParameters))] +[JsonSerializable(typeof(ThrottlingData))] +[JsonSerializable(typeof(SwarmService))] +[JsonSerializable(typeof(SwarmUpdateConfig))] +[JsonSerializable(typeof(ImageLoadParameters))] +[JsonSerializable(typeof(HostConfig))] +[JsonSerializable(typeof(SwarmRestartPolicy))] +[JsonSerializable(typeof(ContainerRenameParameters))] +[JsonSerializable(typeof(ReplicatedJob))] +[JsonSerializable(typeof(EndpointSpec))] +[JsonSerializable(typeof(ImagesListParameters))] +[JsonSerializable(typeof(NetworkAttachmentSpec))] +[JsonSerializable(typeof(ContainerJSONBase))] +[JsonSerializable(typeof(TaskDefaults))] +[JsonSerializable(typeof(PluginCreateParameters))] +[JsonSerializable(typeof(TaskResponse))] +[JsonSerializable(typeof(ImagesPruneResponse))] +[JsonSerializable(typeof(WaitExitError))] +[JsonSerializable(typeof(PluginEnableParameters))] +[JsonSerializable(typeof(MountPoint))] +[JsonSerializable(typeof(ServiceConfig))] +[JsonSerializable(typeof(VolumeResponse))] +[JsonSerializable(typeof(NodeDescription))] +[JsonSerializable(typeof(Actor))] +[JsonSerializable(typeof(NodeCSIInfo))] +[JsonSerializable(typeof(SwarmConfig))] +[JsonSerializable(typeof(NamedGenericResource))] +[JsonSerializable(typeof(VolumesPruneResponse))] +[JsonSerializable(typeof(ContainerResizeParameters))] +[JsonSerializable(typeof(ObjectExtensionData))] +[JsonSerializable(typeof(ContainerInspectResponse))] +[JsonSerializable(typeof(PluginMount))] +[JsonSerializable(typeof(ContainerEventsParameters))] +[JsonSerializable(typeof(PlacementPreference))] +[JsonSerializable(typeof(TasksListParameters))] +[JsonSerializable(typeof(PluginDescription))] +[JsonSerializable(typeof(SwarmCreateConfigResponse))] +[JsonSerializable(typeof(CapacityRange))] +[JsonSerializable(typeof(EncryptionConfig))] +[JsonSerializable(typeof(PluginInterfaceType))] +[JsonSerializable(typeof(Network))] +[JsonSerializable(typeof(PluginConfigArgs))] +[JsonSerializable(typeof(NetworkCreate))] +[JsonSerializable(typeof(Info))] +[JsonSerializable(typeof(SecretReferenceFileTarget))] +[JsonSerializable(typeof(ImageBuildParameters))] +[JsonSerializable(typeof(EmptyStruct))] +[JsonSerializable(typeof(ContainerExecCreateParameters))] +[JsonSerializable(typeof(NetworksPruneResponse))] +[JsonSerializable(typeof(PluginConfig))] +[JsonSerializable(typeof(JSONError))] +[JsonSerializable(typeof(DeviceRequest))] + +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary>))] +[JsonSerializable(typeof(Dictionary>))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary>))] +[JsonSerializable(typeof(Dictionary>))] +[JsonSerializable(typeof(IList
))] +[JsonSerializable(typeof(List
))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList>))] +[JsonSerializable(typeof(List>))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(List))] + +[JsonSerializable(typeof(ContainerListResponse[]))] +[JsonSerializable(typeof(CreateContainerResponse))] +[JsonSerializable(typeof(ContainerInspectResponse))] +[JsonSerializable(typeof(ContainerProcessesResponse))] +[JsonSerializable(typeof(ContainerFileSystemChangeResponse[]))] +[JsonSerializable(typeof(ContainerWaitResponse))] +[JsonSerializable(typeof(ContainersPruneResponse))] +[JsonSerializable(typeof(ContainerUpdateResponse))] +[JsonSerializable(typeof(ServiceCreateResponse))] +[JsonSerializable(typeof(SwarmUnlockResponse))] +[JsonSerializable(typeof(string))] +[JsonSerializable(typeof(SwarmService))] +[JsonSerializable(typeof(SwarmInspectResponse))] +[JsonSerializable(typeof(SwarmService[]))] +[JsonSerializable(typeof(ServiceUpdateResponse))] +[JsonSerializable(typeof(NodeListResponse[]))] +[JsonSerializable(typeof(NodeListResponse))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(TaskResponse))] +[JsonSerializable(typeof(Plugin[]))] +[JsonSerializable(typeof(PluginPrivilege[]))] +[JsonSerializable(typeof(Plugin))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(SecretCreateResponse))] +[JsonSerializable(typeof(Secret))] +[JsonSerializable(typeof(NetworkResponse[]))] +[JsonSerializable(typeof(NetworkResponse))] +[JsonSerializable(typeof(NetworksCreateResponse))] +[JsonSerializable(typeof(NetworksPruneResponse))] +[JsonSerializable(typeof(VolumesListResponse))] +[JsonSerializable(typeof(VolumeResponse))] +[JsonSerializable(typeof(VolumesPruneResponse))] +[JsonSerializable(typeof(IList))] +[JsonSerializable(typeof(SwarmCreateConfigResponse))] +[JsonSerializable(typeof(SwarmConfig))] +[JsonSerializable(typeof(VersionResponse))] +[JsonSerializable(typeof(SystemInfoResponse))] +[JsonSerializable(typeof(ContainerExecCreateResponse))] +[JsonSerializable(typeof(ContainerExecInspectResponse))] +[JsonSerializable(typeof(ImagesListResponse[]))] +[JsonSerializable(typeof(ImageInspectResponse))] +[JsonSerializable(typeof(ImageHistoryResponse[]))] +[JsonSerializable(typeof(Dictionary[]))] +[JsonSerializable(typeof(ImageSearchResponse[]))] +[JsonSerializable(typeof(ImagesPruneResponse))] +[JsonSerializable(typeof(CommitContainerChangesResponse))] + +[JsonSourceGenerationOptions( + UseStringEnumConverter = true, + Converters = + [ + typeof(JsonEnumMemberConverter), + typeof(JsonEnumMemberConverter), + typeof(JsonDateTimeConverter), + typeof(JsonNullableDateTimeConverter), + typeof(JsonBase64Converter) + ])] +public partial class DockerDotnetJsonSerializerContext : JsonSerializerContext +{ + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Privileges))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerListResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.IndexInfo))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImagesCreateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Spec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImagePushParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.RaftConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ComponentVersion))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SecretSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerRestartParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Health))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumesPruneParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NodeUpdateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Commit))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginConfigNetwork))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TmpfsOptions))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServicesListParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceFilter))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceCreationMode))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.WeightDevice))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworksListParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.BlkioStats))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainersPruneResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmLimit))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageDeleteParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PortStatus))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.EndpointIPAMConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerStopParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Runtime))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmLeaveParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.IPAMConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ThrottleDevice))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkConnectParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.HealthcheckResult))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SecretCreateResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmJoinParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkAddressPool))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageDeleteResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerRemoveParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VersionResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.DispatcherConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainersPruneParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.DNSConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Driver))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkSettings))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginEnv))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageTagParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImagesListResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceListParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ShimConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ReplicatedService))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PortBinding))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.CAConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.EndpointResource))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.UsageData))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageBuildResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceMode))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.CredentialSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.StorageStats))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Stats))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerListProcessesParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginRemoveParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkTask))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageSearchResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ClusterOptions))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerStatus))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.UpdateStatus))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.MemoryStats))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.CommitContainerChangesResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.GenericResource))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Message))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.JSONMessage))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceInfo))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ClusterVolumeSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TaskStatus))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ClusterVolume))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.JobStatus))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumesListParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumesListResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImagesSearchParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Plugin))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginSettings))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TopologyRequirement))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TaskSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerStatsResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.EndpointSettings))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.RootFS))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.EndpointVirtualIP))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginPrivilege))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.AuthResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumeOptions))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TypeMount))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.CPUUsage))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TypeBlock))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NodeListResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PortConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Address))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmConfigSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.BlkioStatEntry))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.CreateContainerResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerExecStartParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SummaryNetworkSettings))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageInspectResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.GlobalJob))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerNode))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Port))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageInspectParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerPathStatParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Topology))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkAttachmentConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginInstallParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumesCreateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.GetArchiveFromContainerResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PeerInfo))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Platform))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmUpdateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmUpdateConfigParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginConfigUser))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ConfigReference))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerPathStatResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.DiscreteGenericResource))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerWaitResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Version))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.GetArchiveFromContainerParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerKillParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmInitParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerInspectParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.AuthConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceLogsParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TLSInfo))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Annotations))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Mount))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.UpdateConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerStartParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerLogsParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainersListParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmDriver))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginConfigRootfs))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.EngineDescription))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumeInfo))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumeAttachment))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NodeRemoveParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginsInfo))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ExternalCA))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ConfigReferenceFileTarget))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.RestartPolicy))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SELinuxContext))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceUpdateResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TaskState))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Endpoint))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginDisableParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworksCreateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceCreateResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerFileSystemChangeResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImagesLoadResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkingConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.JSONProgress))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerAttachParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmInspectResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerUpdateResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkAttachment))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.AccessMode))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginUpgradeParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerExecCreateResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmCreateConfigParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumeSecret))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceStatus))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.FileSystemChangeKind))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Placement))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginGetPrivilegeParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.BindOptions))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SystemInfoResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.DeviceMapping))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.JoinTokens))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Ulimit))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkStats))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerStatsParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ClusterInfo))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageHistoryResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmUnlockResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Secret))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.GraphDriverData))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmIPAMConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginConfigureParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Resources))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.DefaultNetworkSettings))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NodeStatus))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Config))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PidsStats))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmUnlockParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginDevice))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImagesPruneParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.LogConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ResourceRequirements))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.CommitContainerChangesParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.RestartPolicyKind))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PublishStatus))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmConfigReference))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.IPAM))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkSettingsBase))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginConfigLinux))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SpreadOver))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumeTopology))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ManagerStatus))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SecretReference))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginListParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.HealthConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageMetadata))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerUpdateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.IPAMOptions))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmResources))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.OrchestrationConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.CPUStats))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.CreateContainerParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginConfigInterface))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Meta))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworksCreateResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.RuntimePluginPrivilege))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworksDeleteUnusedParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceCreateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Peer))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerState))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.GlobalService))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceUpdateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerProcessesResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ConfigReferenceRuntimeTarget))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerExecInspectResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkDisconnectParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ThrottlingData))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmService))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmUpdateConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageLoadParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.HostConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmRestartPolicy))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerRenameParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ReplicatedJob))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.EndpointSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImagesListParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkAttachmentSpec))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerJSONBase))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TaskDefaults))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginCreateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TaskResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImagesPruneResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.WaitExitError))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginEnableParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.MountPoint))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ServiceConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumeResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NodeDescription))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Actor))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NodeCSIInfo))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NamedGenericResource))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.VolumesPruneResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerResizeParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ObjectExtensionData))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerInspectResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginMount))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerEventsParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PlacementPreference))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.TasksListParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginDescription))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SwarmCreateConfigResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.CapacityRange))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.EncryptionConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginInterfaceType))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Network))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginConfigArgs))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworkCreate))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.Info))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.SecretReferenceFileTarget))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ImageBuildParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.EmptyStruct))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.ContainerExecCreateParameters))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.NetworksPruneResponse))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.PluginConfig))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.JSONError))] + [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.DeviceRequest))] + internal static void PreserveReflection() + { + } +} diff --git a/src/Docker.DotNet/EnumerableQueryStringConverter.cs b/src/Docker.DotNet/EnumerableQueryStringConverter.cs index 6b2fe59a..cf609f3d 100644 --- a/src/Docker.DotNet/EnumerableQueryStringConverter.cs +++ b/src/Docker.DotNet/EnumerableQueryStringConverter.cs @@ -24,14 +24,13 @@ public string[] Convert(object o) var items = new List(); foreach (var e in ((IEnumerable) o)) { - if (e is ValueType || - e is string) + if (e is ValueType || e is string) { items.Add(e.ToString()); } else { - items.Add(System.Text.Json.JsonSerializer.Serialize(e)); + throw new NotImplementedException(); } } diff --git a/src/Docker.DotNet/JsonQueryStringConverter.cs b/src/Docker.DotNet/JsonQueryStringConverter.cs deleted file mode 100644 index 61b05a3f..00000000 --- a/src/Docker.DotNet/JsonQueryStringConverter.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Diagnostics; - -namespace Docker.DotNet.Models -{ - internal class JsonQueryStringConverter : IQueryStringConverter - { - public bool CanConvert(Type t) - { - return true; - } - - public string[] Convert(object o) - { - Debug.Assert(o != null); - - return new[] {System.Text.Json.JsonSerializer.Serialize(o)}; - } - } -} \ No newline at end of file diff --git a/src/Docker.DotNet/JsonSerializer.cs b/src/Docker.DotNet/JsonSerializer.cs index d9b97992..5c8b06ef 100644 --- a/src/Docker.DotNet/JsonSerializer.cs +++ b/src/Docker.DotNet/JsonSerializer.cs @@ -3,12 +3,11 @@ using System.IO; using System.IO.Pipelines; using System.Net.Http; -using System.Net.Http.Json; using System.Runtime.CompilerServices; +using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; -using Docker.DotNet.Models; namespace Docker.DotNet { @@ -17,17 +16,10 @@ namespace Docker.DotNet /// internal class JsonSerializer { - private readonly JsonSerializerOptions _options = new() + public JsonSerializer() { - Converters = - { - new JsonEnumMemberConverter(), - new JsonEnumMemberConverter(), - new JsonDateTimeConverter(), - new JsonNullableDateTimeConverter(), - new JsonBase64Converter(), - }, - }; + DockerDotnetJsonSerializerContext.PreserveReflection(); + } // Adapted from https://github.com/dotnet/runtime/issues/33030#issuecomment-1524227075 public async IAsyncEnumerable Deserialize(Stream stream, [EnumeratorCancellation] CancellationToken cancellationToken) @@ -39,7 +31,8 @@ public async IAsyncEnumerable Deserialize(Stream stream, [EnumeratorCancel var buffer = result.Buffer; while (!buffer.IsEmpty && TryParseJson(ref buffer, out var jsonDocument)) { - yield return jsonDocument.Deserialize(_options); + var deserializedObj = jsonDocument.Deserialize(typeof(T), DockerDotnetJsonSerializerContext.Default); + yield return (T) deserializedObj; } if (result.IsCompleted) @@ -68,23 +61,28 @@ private static bool TryParseJson(ref ReadOnlySequence buffer, out JsonDocu public T DeserializeObject(byte[] json) { - return System.Text.Json.JsonSerializer.Deserialize(json, _options); + var deserializedObj = System.Text.Json.JsonSerializer.Deserialize(json, typeof(T), DockerDotnetJsonSerializerContext.Default); + return (T)deserializedObj; } public byte[] SerializeObject(T value) { - return System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(value, _options); + var jsonString = System.Text.Json.JsonSerializer.Serialize(value, typeof(T), DockerDotnetJsonSerializerContext.Default); + return Encoding.UTF8.GetBytes(jsonString); } - public JsonContent GetHttpContent(T value) + public HttpContent GetHttpContent(T value) { - return JsonContent.Create(value, options: _options); + var jsonString = System.Text.Json.JsonSerializer.Serialize(value, typeof(T), DockerDotnetJsonSerializerContext.Default); + HttpContent httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json"); + return httpContent; } public async Task DeserializeAsync(HttpContent content, CancellationToken token) { - return await content.ReadFromJsonAsync(_options, token) - .ConfigureAwait(false); + var jsonString = await content.ReadAsStringAsync(token); + var deserializedObj = System.Text.Json.JsonSerializer.Deserialize(jsonString, typeof(T), DockerDotnetJsonSerializerContext.Default); + return (T)deserializedObj; } } } diff --git a/src/Docker.DotNet/MapQueryStringConverter.cs b/src/Docker.DotNet/MapQueryStringConverter.cs index 6078541f..20f3e3cf 100644 --- a/src/Docker.DotNet/MapQueryStringConverter.cs +++ b/src/Docker.DotNet/MapQueryStringConverter.cs @@ -16,7 +16,8 @@ public string[] Convert(object o) { Debug.Assert(o != null); - return new[] { System.Text.Json.JsonSerializer.Serialize(o) }; + var jsonString = System.Text.Json.JsonSerializer.Serialize(o, o.GetType(), DockerDotnetJsonSerializerContext.Default); + return new[] { jsonString }; } } } \ No newline at end of file diff --git a/src/Docker.DotNet/Models/RestartPolicyKind.cs b/src/Docker.DotNet/Models/RestartPolicyKind.cs index d7f39178..79b07e9f 100644 --- a/src/Docker.DotNet/Models/RestartPolicyKind.cs +++ b/src/Docker.DotNet/Models/RestartPolicyKind.cs @@ -5,9 +5,6 @@ namespace Docker.DotNet.Models public enum RestartPolicyKind { - [EnumMember(Value = "")] - Undefined, - [EnumMember(Value = "no")] No, diff --git a/src/Docker.DotNet/QueryStringConverterInstanceFactory.cs b/src/Docker.DotNet/QueryStringConverterInstanceFactory.cs index 6410c639..c9aa4a44 100644 --- a/src/Docker.DotNet/QueryStringConverterInstanceFactory.cs +++ b/src/Docker.DotNet/QueryStringConverterInstanceFactory.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Concurrent; +using Docker.DotNet.Models; namespace Docker.DotNet { @@ -9,19 +10,19 @@ internal class QueryStringConverterInstanceFactory : IQueryStringConverterInstan public IQueryStringConverter GetConverterInstance(Type t) { - return ConverterInstanceRegistry.GetOrAdd( - t, - InitializeConverter); + return ConverterInstanceRegistry.GetOrAdd(t, InitializeConverter); } private IQueryStringConverter InitializeConverter(Type t) { - var instance = Activator.CreateInstance(t) as IQueryStringConverter; - if (instance == null) + return t.Name switch { - throw new InvalidOperationException($"Could not get instance of {t.FullName}"); - } - return instance; + nameof(BoolQueryStringConverter) => new BoolQueryStringConverter(), + nameof(EnumerableQueryStringConverter) => new EnumerableQueryStringConverter(), + nameof(MapQueryStringConverter) => new MapQueryStringConverter(), + nameof(TimeSpanSecondsQueryStringConverter) => new TimeSpanSecondsQueryStringConverter(), + _ => throw new InvalidOperationException($"Could not get instance of {t.FullName}") + }; } } } \ No newline at end of file diff --git a/tools/specgen/GenJsonSerializerContext.cs b/tools/specgen/GenJsonSerializerContext.cs new file mode 100644 index 00000000..164c5898 --- /dev/null +++ b/tools/specgen/GenJsonSerializerContext.cs @@ -0,0 +1,112 @@ + +// File-based app to generate the JsonSerializerContext +// Generates the DefaultJsonSerializerContext.cs from all classes in the Models folder + +#:package Microsoft.CodeAnalysis.CSharp@4.14.0 + +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +string modelsDirectoryPath = @"../../src/Docker.DotNet/Models"; +var modelFiles = Directory.GetFiles(modelsDirectoryPath, "*.cs", SearchOption.AllDirectories); + +string endpointDirectoryPath = @"../../src/Docker.DotNet/Endpoints"; +var endpointFiles = Directory.GetFiles(endpointDirectoryPath, "*.cs", SearchOption.AllDirectories); + +HashSet allBaseTypeDeclarations = []; +HashSet allDynamicDependenciesAttributes = []; +HashSet allPropertyDeclarations = []; +HashSet allDockerApiResponseTypes = []; + +foreach (var file in modelFiles) +{ + var code = File.ReadAllText(file); + var tree = CSharpSyntaxTree.ParseText(code); + var root = tree.GetCompilationUnitRoot(); + + var baseTypeDeclarations = root.DescendantNodes().OfType(); + + foreach (var typeDecl in baseTypeDeclarations) + { + var name = typeDecl.Identifier.Text; + allBaseTypeDeclarations.Add($"[JsonSerializable(typeof({name}))]"); + allDynamicDependenciesAttributes.Add($"[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Docker.DotNet.Models.{name}))]"); + } + + var propertyDeclarations = root.DescendantNodes().OfType(); + + foreach (var typeSyntax in propertyDeclarations) + { + var typeString = typeSyntax.Type.ToString(); + if (typeString.StartsWith("IDictionary") || typeString.StartsWith("IList")) + { + allPropertyDeclarations.Add($"[JsonSerializable(typeof({typeString}))]"); + allPropertyDeclarations.Add($"[JsonSerializable(typeof({typeString.Substring(1)}))]"); + } + } +} + +foreach (var file in endpointFiles) +{ + var code = File.ReadAllText(file); + var tree = CSharpSyntaxTree.ParseText(code); + var root = tree.GetCompilationUnitRoot(); + + var invocations = root.DescendantNodes().OfType(); + + foreach (var invocation in invocations) + { + if (invocation.Expression is MemberAccessExpressionSyntax memberAccess + && memberAccess.Name is GenericNameSyntax genericMember + && genericMember.Identifier.Text.Contains("MakeRequestAsync")) + { + foreach (var typeArg in genericMember.TypeArgumentList.Arguments) + { + allDockerApiResponseTypes.Add($"[JsonSerializable(typeof({typeArg.ToString()}))]"); + } + } + } +} + +var fileContent = +$$""" +// + +using Docker.DotNet.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; + +using Version = Docker.DotNet.Models.Version; + +namespace Docker.DotNet; + +{{string.Join(Environment.NewLine, allBaseTypeDeclarations)}} + +{{string.Join(Environment.NewLine, allPropertyDeclarations)}} + +{{string.Join(Environment.NewLine, allDockerApiResponseTypes)}} + +[JsonSourceGenerationOptions( + UseStringEnumConverter = true, + Converters = + [ + typeof(JsonEnumMemberConverter), + typeof(JsonEnumMemberConverter), + typeof(JsonDateTimeConverter), + typeof(JsonNullableDateTimeConverter), + typeof(JsonBase64Converter) + ])] +public partial class DockerDotnetJsonSerializerContext : JsonSerializerContext +{ + {{string.Join(Environment.NewLine + " ", allDynamicDependenciesAttributes)}} + internal static void PreserveReflection() + { + } +} + +"""; + + +string savePath = @"../../src/Docker.DotNet/DockerDotnetJsonSerializerContext.Generated.cs"; +File.WriteAllText(savePath, fileContent);