Skip to content

feat(common): support null value of reference type collection element in deserialization #3159

@archerzz

Description

@archerzz

Description

This is the follow-up of #3084. Right now, our generated deserialization logic will not handle null value of reference type collection element. This will fail the OpenAI service which will return null for CompletionsLogProbability.CompletionsLogProbability.

Expected Deserialization Logic

In the customization codes, we add null value handling: https://github.com/Azure/azure-sdk-for-net/blob/bc5930762b8f33ce0df7929baf0662748c96b719/sdk/openai/Azure.AI.OpenAI/src/Custom/CompletionsLogProbability.Serialization.cs#L70-L87

if (item.ValueKind == JsonValueKind.Null)
{
    array.Add(null);
}

Actual Generated Logic

See previous version which is generated: https://github.com/Azure/azure-sdk-for-net/blob/a4392f3e9da4864fb98457ba41fc93fe82a11d97/sdk/openai/Azure.AI.OpenAI/src/Generated/CompletionsLogProbability.Serialization.cs#L70-L80

It doesn't handle null value.

It's a known issue for MPG as well.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions