Repository navigation
Conversation
ApiClient.cs imported the model namespace only to reach AbstractOpenAPISchema, so a schema named like a type ApiClient uses unqualified (Parameter, ParameterType, Task, RestRequest, DateTime, ...) made the generated client fail to compile with CS0104. Qualify AbstractOpenAPISchema as the httpclient ApiClient already does and drop the using.
A schema named ValidationResult generates a model that hides System.ComponentModel.DataAnnotations.ValidationResult inside the model namespace, so every IValidatableObject.Validate implementation stopped compiling. Qualify it as ValidateRegex, modelOneOf and modelAnyOf already do.
MrD4rkne
marked this pull request as ready for review
October 16, 2026 11:03
Contributor
There was a problem hiding this comment.
No issues found across 2598 files
Note: This PR contains a large number of files. cubic selects up to 200 of the highest-priority eligible files for this review, so some files may not have been reviewed.
View guided diff | Re-trigger cubic
Contributor
Author
|
PR got kinda big (because it touches a lot of |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A schema named
Parameter,ParameterType,Task,RestRequest, … broke the restsharpApiClient.cswith CS0104, because it imported the model namespace only to reachAbstractOpenAPISchema. A schema namedValidationResulthidSystem.ComponentModel.DataAnnotations.ValidationResultinside the model namespace, so everyIValidatableObject.Validateimplementation stopped compiling.ApiClient.mustache/ApiClient.v790.mustache: dropusing {{packageName}}.{{modelPackage}};and qualifyAbstractOpenAPISchema, as the httpclientApiClientalready does.validatable.mustache: qualifySystem.ComponentModel.DataAnnotations.ValidationResult, asValidateRegex,modelOneOfandmodelAnyOfalready do. generichost shares this template, so its samples change too; that is most of the sample diff.3_0/csharp/model-name-collisions.yamland two tests inCSharpClientCodegenTest. restsharp and httpclient clients generated from that spec now compile under net8; on master they fail with CS0104 (Parameter,ParameterType,Task) and aValidatereturn-type mismatch (ValidationResult).Related: #16123
PR checklist
cc @mandrean @shibayan @Blackclaws @lucamazzanti
Summary by cubic
Fixes C# code generation so schemas named like framework types no longer produce code that fails to compile. Previously, a schema named
Parameter,ParameterType,Task, orValidationResultbroke the generated restsharp client with CS0104, becauseApiClient.csimported the model namespace and models hidSystem.ComponentModel.DataAnnotations.ValidationResult.ApiClienttemplates and qualified allAbstractOpenAPISchemareferences.ValidationResultasSystem.ComponentModel.DataAnnotations.ValidationResultin thevalidatable.mustachetemplate shared by restsharp and generichost.Written for commit 9204dfc. Summary will update on new commits.