autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Can't generate with "vesrion-tolerant" in swagger readme settings

Open YalinLi0312 opened this issue 2 years ago • 8 comments

Before filling a bug

  • [ ] have you checked the faq for known issues.
  • [ ] have you checked existing issues

Describe the bug The error thrown when I trying to regenerate python appconfiguration package.

  • Autorest command used: autorest --python --v3 .\swagger\README.md
  • I set version-tolerant: false in swagger readme, the full readme is:
## Azure Appconfiguration for Python

### Settings
``` yaml
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/1.0/appconfiguration.json
output-folder: "../azure/appconfiguration/_generated"
namespace: azure.appconfiguration
no-namespace-folders: true
python: true
python-mode: create
license-header: MICROSOFT_MIT_NO_VERSION
package-name: azure-appconfiguration
clear-output-folder: true
enable-xml: true
vanilla: true
vesrion-tolerant: false

Expected behavior Generate the package without errors.

Additional context The error I got: image

YalinLi0312 avatar Sep 20 '22 23:09 YalinLi0312

@YalinLi0312 I don't think this has to do with the flag version-tolerant specifically, I recently ran into this issue with --cadl-init

iscai-msft avatar Sep 20 '22 23:09 iscai-msft

can you share the entire readme, right now it looks like this could be due to the yaml code block not being closed

timotheeguerin avatar Sep 20 '22 23:09 timotheeguerin

Oh, it is closed, I removed the last line to make the description looks better. Here's the entire readme:

Azure Appconfiguration for Python

Settings

input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/1.0/appconfiguration.json
output-folder: "../azure/appconfiguration/_generated"
namespace: azure.appconfiguration
no-namespace-folders: true
python: true
python-mode: create
license-header: MICROSOFT_MIT_NO_VERSION
package-name: azure-appconfiguration
clear-output-folder: true
enable-xml: true
vanilla: true
version-tolerant: false

YalinLi0312 avatar Sep 20 '22 23:09 YalinLi0312

hhm that config works just fine for me image is there more info if you use --verbose --debug

timotheeguerin avatar Sep 20 '22 23:09 timotheeguerin

Yes. And I can get the same as yours when run script out of test folder - I made a mistake, the swagger is outside test folder.

Do you mean the two "writing failed" in the output are expected?

YalinLi0312 avatar Sep 20 '22 23:09 YalinLi0312

that error seems to be related to the black formatter that runs after, The code should still have been generated. @iscai-msft might know more about this particular issue. Is that the only error you see now? or do you still have case where you get no input files

timotheeguerin avatar Sep 20 '22 23:09 timotheeguerin

Yes, that's the only error I see now. I checked the generated folder, I got the models back with version-tolerant: false. But I'm not sure if there's any issues in generated code as it saying there are two failings in the autorest command output.

@iscai-msft Do you know if we can use the generated code with the two errors while generating?

YalinLi0312 avatar Sep 21 '22 00:09 YalinLi0312

@YalinLi0312 can you show the errors you're running into?

iscai-msft avatar Sep 21 '22 16:09 iscai-msft

I got the same result as timo's, you can see there are two errors in output.

YalinLi0312 avatar Sep 23 '22 00:09 YalinLi0312

it seems these are more warnings and not failrues since the black step doesn't fail. Closing this issue because I don't think there's an issue here anymore. @YalinLi0312 let me know if you're ok with this!

iscai-msft avatar Sep 23 '22 21:09 iscai-msft

I don't see any issues with the current generated code in AooConfig. Yeah, it's ok to close this isse. Thanks @iscai-msft @timotheeguerin for your help!

YalinLi0312 avatar Sep 23 '22 22:09 YalinLi0312