Skip to content

[csharp][generichost] Make host configuration optional - #24451

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
devhl-labs:devhl/make-host-configuration-optional
Jul 26, 2026
Merged

[csharp][generichost] Make host configuration optional#24451
wing328 merged 1 commit into
OpenAPITools:masterfrom
devhl-labs:devhl/make-host-configuration-optional

Conversation

@devhl-labs

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

Copy link
Copy Markdown
Contributor

Library authors can provide a default configuration using the partial method, so we can let this parameter be null.

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

Make HostConfiguration optional in generated csharp generichost service registration by updating IServiceCollectionExtensions.Add{Api} to accept an optional options callback and use defaults when none is provided. This simplifies the API surface and keeps existing calls working.

  • Refactors
    • Consolidated to a single method: Add{Api}(IServiceCollection services, Action<HostConfiguration>? options = null); invokes options?.Invoke(config).
    • Removed the parameterless overload previously generated when no auth methods were present.
    • Applies nullable annotation when NRT is enabled; regenerated samples to match.

Written for commit b040be2. 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 51 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@wing328
wing328 merged commit b24e4e7 into OpenAPITools:master Jul 26, 2026
77 checks passed
@wing328 wing328 added Client: C-Sharp Enhancement: Code Cleanup General refactoring, removal of deprecated things, commenting, etc. labels Jul 26, 2026
@wing328 wing328 added this to the 7.25.0 milestone Jul 26, 2026
@devhl-labs
devhl-labs deleted the devhl/make-host-configuration-optional branch July 26, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Client: C-Sharp Enhancement: Code Cleanup General refactoring, removal of deprecated things, commenting, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants