Skip to content

Add protected internal support to CodeGenVisibility for StreamingResponseUpdate#1172

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/support-protected-internal-visibility
Draft

Add protected internal support to CodeGenVisibility for StreamingResponseUpdate#1172
Copilot wants to merge 2 commits into
mainfrom
copilot/support-protected-internal-visibility

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

The codegen customization pipeline could only express internal and public, which left StreamingResponseUpdate stuck with a generated private protected two-parameter constructor. This change extends the existing CodeGenVisibility path so constructor visibility can be customized as protected internal and applies it to StreamingResponseUpdate.

  • CodeGenVisibility contract

    • Add ProtectedInternal to the shared CodeGenVisibility enum used by customization partials.
  • Generator visibility handling

    • Extend VisibilityVisitor to translate the new enum value into MethodSignatureModifiers.Protected | MethodSignatureModifiers.Internal.
    • Update modifier assignment to clear and replace all visibility flags consistently for constructors, methods, and properties.
  • StreamingResponseUpdate customization

    • Add a CodeGenVisibility attribute on the StreamingResponseUpdate customization partial targeting:
      • StreamingResponseUpdateKind kind
      • int sequenceNumber
  • Regenerated output

    • Regenerate StreamingResponseUpdate so the generated constructor is emitted as protected internal.
    • Refresh the exported OpenAI.Responses API surface to reflect the new constructor visibility.
  • Regression coverage

    • Add a focused generator test covering constructor visibility remapping through VisibilityVisitor.

Example customization:

[CodeGenVisibility(
    nameof(StreamingResponseUpdate),
    CodeGenVisibility.ProtectedInternal,
    typeof(StreamingResponseUpdateKind),
    typeof(int))]
public partial class StreamingResponseUpdate
{
}

Agent-Logs-Url: https://github.com/openai/openai-dotnet/sessions/ae3423fa-b033-43fe-991f-06c271239739

Co-authored-by: joseharriaga <45773732+joseharriaga@users.noreply.github.com>
Copilot AI changed the title [WIP] Support protected internal visibility for StreamingResponseUpdate constructor Add protected internal support to CodeGenVisibility for StreamingResponseUpdate May 19, 2026
Copilot AI requested a review from joseharriaga May 19, 2026 06:16
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.

Support protected internal visibility for StreamingResponseUpdate constructor via CodeGenVisibility

2 participants