Skip to content

OAI - JsonPatch serialization code is missing in model with custom serialization #8616

@jorgerangel-msft

Description

@jorgerangel-msft

See https://github.com/openai/openai-dotnet/blob/d66058ce4b7cdc41e3d7a59f317941bbbf22cbd2/src/Generated/Models/Chat/ChatMessageContentPart.Serialization.cs#L24-L25. This model has custom serialization code, and the generated code ends up looking like:

protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
        {
            string format = options.Format == "W" ? ((IPersistableModel<ChatMessageContentPart>)this).GetFormatFromOptions(options) : options.Format;
            if (format != "J")
            {
                throw new FormatException($"The model {nameof(ChatMessageContentPart)} does not support writing '{format}' format.");
            }
#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
#pragma warning restore SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
        }

Metadata

Metadata

Labels

emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharp

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions