Skip to content

Conversation

@aleksator
Copy link

TypeSpec definition:

nullableString: string | null;

produces

[JsonConverter(typeof(JsonStringEnumConverter))]
public string NullableString { get; set; }

when generated with http-server-csharp. The JsonStringEnumConverter is incorrectly applied because string | null is detected as a "string enum" union type. This always fails in runtime on deserialization.

This PR removes JsonConverter, generating

public string NullableString { get; set; }

When built on top of #9439, the generated code becomes:

public string? NullableString { get; set; }

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

Successfully merging this pull request may close these issues.

1 participant