Skip to content

[Bug]: Per OpenAPI Non-nullable enum can be indeed null #169

Description

@Baumbart13

What happened?

Get checkouts
GET https://api.sumup.com//v0.1/merchants/{merchant_code}/readers/{reader_id}/checkout/{checkout_id}

The return value of GetReaderCheckoutResponseDataCardType can happen to be null, but the property CardType in GetReaderCheckoutResponseData gets generated as a non-nullable enum.

Content of the JSON:
{"data":{"card_type":null,"checkout_id":"8cd0fc7e-e1f1-462a-b6f5-14b924521aba","client_transaction_id":"8390f4b5-2a65-499b-bd14-27d7b4002bfd","created_at":"2026-08-18T15:08:20.242357Z","installments":null,"payment_failure_reason":null,"payment_status":null,"payment_type":"card","reader_firmware_version":"v0.1.0","reader_serial_number":"virtual_solo_e8a00ef0-6d38-480d-bf3c-e233b3223693","status":"pending","total_amount":{"currency":"EUR","minor_unit":2,"value":1000},"updated_at":"2026-08-18T15:08:20.256784Z","valid_until":"2026-08-18T15:09:20.242176Z"}}

Relevant code or error output

var client = new SumUpClient();
var readerCheckoutCreated = await client.Readers.CreateCheckoutAsync(merchantCode, readerId, request, requestOptions);
var readerCheckoutFetched = await client.Readers.GetCheckoutAsync(merchantCode, readerId, readerCheckoutCreated.Data.Data.CheckoutId, requestOptions);

[ERR] System.Text.Json.JsonException: Unable to convert value to enum type 'SumUp.GetReaderCheckoutResponseDataCardType'.
   at SumUp.EnumMemberJsonConverterFactory.EnumMemberJsonConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) in C:\prog\repos\sumup-dotnet-baumbart13\src\SumUp\EnumMemberJsonConverterFactory.cs:line 90

SDK version

0.0.18

.NET SDK or runtime version

.NET 8

Target framework

net8.0

Operating system

Windows 11

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions