-
Notifications
You must be signed in to change notification settings - Fork 169
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
The generator crashes when a model gets properties with the same name from multiple base models (in swagger) #4127
Comments
Hey @KotanaSai21 this error is coming from some autorest v2 plugins which is not maintained anymore. Can you share the command you tried to run? |
Thanks for the reply @timotheeguerin. I think I missed removing the Microsoft.Rest dependency from this file. Will remove the entire dependency of Microsoft.Rest and try to regenerate the client files using the latest version. Please let me know if there is a gap in the command I'm trying to run to generate files. |
That would be the problem that version of csharp is not the latest but the one that worked with autorest v2. latest is 3.0.0-beta.20240109.1 they do have a weird naming. |
Thank you so much @timotheeguerin. We will try using this version. We will work on this and reach out to you if we have any other issues in future. |
Hy @timotheeguerin , But now I'm facing another issue. Could you please help me to fix this issue? Unable to find any doc or reason why it is failing. Found one github issue but didn't understand how to resolve this. |
Do you have a single value enum in your swagger somewhere with the value int32 but you have no type of that definition? can you share the swagger ptherwise |
Thanks again @timotheeguerin . Yes, we have an Enum and was Able to resolve that issue and was able to generate the files using auto rest v3 successfully. But we have model class files, and I was unable to generate the model class files using v3. Found this GitHub Issue on how to generate model class files. Here is my config code. input-file: swaggers\swagger.json
namespace: Microsoft.PowerBI.Api
csharp: true
output-folder: PowerBI.Api\Source
clear-output-folder: true
override-client-name: PowerBIClient
generation1-convenience-client: true
add-credentials: true
model-name: PowerBIClient While generating the files, getting this error. Could you please help me out in resolving this issue? Thank You :) |
Transferred to the csharp extension repo as this now seems to be just the problem crashing in it |
Hi @KotanaSai21 use the swagger I found here, I have a
which is a minor issue, I replaced every Am I using the out-dated swagger? |
Hi @ArcturusZhang , Thanks for looking into this. I forked the repository here and made necessary changes. Resolved the issues with the swagger and find the updated swagger file here. I was able to generate the files but when adding |
Here is the issue: https://github.com/KotanaSai21/PowerBI-CSharp/blob/master/sdk/swaggers/swagger.json#L9878 |
OK the second issue happens in your swagger as well: |
In the meantime, I suggest we could try to write your spec using typespec and use our latest generator to generate which produces better code, and as well as making your spec more intuitive using typespec. |
Since it is not currently supported to have the same property, created a duplicate property and updated my swagger file as a workaround for now. Now I am able to generate the Models files. Thanks so much @ArcturusZhang , @timotheeguerin for helping me in generating the files. |
It is great that the workaround works for you. |
When we generated the files using auto rest, I was facing issue with the models property. Opened a GitHub issue #4294. But no one replied. @ArcturusZhang , @timotheeguerin Could you guys help me out with the issue or guide me to correct place where I can get response. |
Migrating a C# SDK application from Microsoft.Rest.ClientRuntime to Azure.Core. While regenerating the client files using v3 of the AutoRest tooling getting this error.
These are the versions of autorest we're using.
Here is my swagger file. Could you please let me know how to resolve this error ?
The text was updated successfully, but these errors were encountered: