-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG][csharp] Twitter Open API does not compile - Missing AnyType
and BaseValidate
#7458
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
I am also looking for this. Thank you. |
@dumbgamedev I have changed the generated code to prevent the issue from happening again. But there are many different issues with the generated models and logic. I am the developer of Tweetinvi a .NET library to access Twitter. I have taken the decision to write the models myself until the open api generator can better support the complex schema of Twitter. Tonight I will push a first code change that will allow you to access the User and Tweet endpoints on Tweetinvi 6.0 branch. I hope this helps you. Cheers! |
Any plans for fixing this? Perhaps it would be fine for now to remove/uncomment the method call? |
Can you give the latest master a try, which should have the AnyType issue fixed in the |
I did try this with openapi-generator-cli-5.0.0-20201026.051158-829.jar. |
Do you mind elaborating on the |
Model/RecommendationRequest.cs(158,30): error CS0103: The name 'BaseValidate' does not exist in the current context [/home/felschr/dev/work/projectname/common/api/csharp/combined/src/ProjectName.Api/ProjectName.Api.csproj] This is the relevant code in the IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
foreach(var x in BaseValidate(validationContext)) yield return x;
yield break;
} Some people just removed the affected parts from their generated code to work around the issue: |
There is more detail about the problem and a proposed fix in the swagger-codegen repo in issue 7669. The root of the problem seems to be that Dictionary isn't treated as a system type. |
Please merge PR #7669! |
Bug Report Checklist
Description
When building from the official Twitter open api (https://api.twitter.com/labs/2/openapi.json and postman) in csharp, the generation completes with some warnings and building the project fails.
The project mainly contains 2 issues:
AnyType
is missingBaseValidate
method is used but is sometimes not defined.openapi-generator version
4.3.1
OpenAPI declaration file content or url
https://api.twitter.com/labs/2/openapi.json
Generation Details
openapi-generator logs (click to expand)
dotnet build logs (click to expand)
Steps to reproduce
curl https://api.twitter.com/labs/2/openapi.json --output twitter-v2-open-api.json openapi-generator generate -i twitter-v2-open-api.json -g csharp-netcore cd src/Org.OpenAPITools dotnet restore dotnet build
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: