Skip to content
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

DeleteNamespacedServiceWithHttpMessagesAsync - k8s.Models.V1ServiceStatus #847

Closed
atangeman opened this issue May 2, 2022 · 2 comments
Closed

Comments

@atangeman
Copy link

atangeman commented May 2, 2022

Hello,

I am having an issue with the DeleteNamespacedServiceWithHttpMessagesAsync and DeleteNamespacedServiceAsync methods. Why are these the only delete methods that return an object of the parent type? DeleteNamespacedDeployment, Container, ConfigMap, etc all return V1Status.

IntelliSense claims these return a type of HttpOperationResponse<V1Service> but I receive a serialization error from System.Text.Json when I attempt to use it.

image

Am I supposed to be using a different JsonSerializer than System.Text? Newtonsoft wasn't working with other aspects of the API client. It's almost as though the actual method is attempting to V1ServiceStatus but the method signature is set to V1Service

Please review

Code:

public async Task<HttpOperationResponse<V1Service>> DeleteService(string ns, string name)
{
    return await KubeClient.DeleteNamespacedServiceWithHttpMessagesAsync(name, ns);
}

Error:

System.Text.Json.JsonException: The JSON value could not be converted to k8s.Models.V1ServiceStatus. Path: $.status | LineNumber: 0 | BytePositionInLine: 67.
   at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
@tg123
Copy link
Member

tg123 commented May 2, 2022

can you confirm your server version and client version

this is likely caused by version mismatch

@tg123
Copy link
Member

tg123 commented May 2, 2022

see #824

@tg123 tg123 closed this as completed May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants