Skip to content

Neokil fix/csharp test type name collision - #24522

Draft
wing328 wants to merge 17 commits into
masterfrom
Neokil-fix/csharp-test-type-name-collision
Draft

Neokil fix/csharp test type name collision#24522
wing328 wants to merge 17 commits into
masterfrom
Neokil-fix/csharp-test-type-name-collision

Conversation

@wing328

@wing328 wing328 commented Jul 30, 2026

Copy link
Copy Markdown
Member

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

Fixes model name collisions in generated C# Generic Host API tests and corrects response type flags (array/map/free-form) in codegen. Adds patches for Elm, Protobuf schema, and WSDL generators to keep object response handling consistent.

  • Bug Fixes
    • In csharp/libraries/generichost/api_test.mustache, Assert.IsType<> now prefixes model return types with {{packageName}}.{{modelPackage}} (only when isModel) to avoid ambiguous references.
    • In DefaultCodegen.fromResponse, properly sets isArray, isMap, isModel, and isFreeFormObject for response schemas and preserves container metadata.
    • In ElmClientCodegen, ProtobufSchemaCodegen, and WsdlSchemaCodegen, override fromResponse to set object response flags and container info, restoring prior behavior for object responses.
    • Updated tests and samples: added a C# unit test to verify map response flags; expanded Java CXF tests to cover array/map responses; regenerated C# Generic Host samples across latest, net8, net10, net4.7, and net4.8.

Written for commit 3c8cb92. Summary will update on new commits.

Review in cubic

Neokil and others added 6 commits March 27, 2026 11:14
…tandard library name collisions

When a model class shares a name with a .NET standard library type (e.g.
`Attributes`), the generated `Assert.IsType<Attributes>(model)` call is
ambiguous and fails to compile. Use the fully-qualified type name
`{{packageName}}.{{modelPackage}}.{{{.}}}` for model return types so the
generated test code is unambiguous regardless of model naming.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…generichost/api_test.mustache

Co-authored-by: Christopher Molin <28791817+Chrimle@users.noreply.github.com>
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.

2 participants