Skip to content

[csharp][generichost] Add partial methods to host configuration#24343

Merged
wing328 merged 3 commits into
OpenAPITools:masterfrom
devhl-labs:devhl/add-host-configuration-partials
Jul 19, 2026
Merged

[csharp][generichost] Add partial methods to host configuration#24343
wing328 merged 3 commits into
OpenAPITools:masterfrom
devhl-labs:devhl/add-host-configuration-partials

Conversation

@devhl-labs

@devhl-labs devhl-labs commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Please merge #24342 first

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Add partial hooks to HostConfiguration in csharp generichost templates and simplify IHostBuilder.Configure{{apiName}} by removing the IServiceCollection parameter and making options optional. Updates all samples to the new API.

  • New Features

    • HostConfiguration is now partial and exposes:
      • partial void OnHostConfigurationCreated() for post-constructor setup.
      • partial void OnAdd{{apiName}}HttpClientBuilder(IHttpClientBuilder builder) to set default HttpClient config before user overrides.
      • partial void OnServicesAdded(IServiceCollection services) (invoked via NotifyServicesAdded) after DI registration.
    • Configure{{apiName}}(this IHostBuilder, Action<HostBuilderContext, HostConfiguration> options = null) replaces the old (context, services, options) signature; options is now optional.
  • Migration

    • Update calls to .Configure{{apiName}}((context, options) => { ... }) or omit options entirely.
    • If you previously used services inside the Configure lambda, move registrations to builder.ConfigureServices(...) or use the new partial hooks.

Written for commit 74aa879. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 303 files

Note: This PR contains a large number of files. cubic only reviews up to 200 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.

Re-trigger cubic

@wing328
wing328 merged commit dfdb6e6 into OpenAPITools:master Jul 19, 2026
76 checks passed
@wing328 wing328 added this to the 7.24.0 milestone Jul 19, 2026
@devhl-labs
devhl-labs deleted the devhl/add-host-configuration-partials branch July 19, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants