Skip to content
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

Codegen Error in generating iothub track2 #812

Closed
00Kai0 opened this issue Nov 9, 2020 · 4 comments · Fixed by #813
Closed

Codegen Error in generating iothub track2 #812

00Kai0 opened this issue Nov 9, 2020 · 4 comments · Fixed by #813
Assignees

Comments

@00Kai0
Copy link

00Kai0 commented Nov 9, 2020

Hi @lmazuel , When I generated iothub track2, but I got an error:

Traceback (most recent call last):
  File "/root/.autorest/@[email protected]/node_modules/@autorest/python/autorest/jsonrpc/server.py", line 50, in Process
    return plugin.process()
  File "/root/.autorest/@[email protected]/node_modules/@autorest/python/autorest/codegen/init.py", line 279, in process
    code_model = self._create_code_model(yaml_data=yaml_data, options=options)
  File "/root/.autorest/@[email protected]/node_modules/@autorest/python/autorest/codegen/init.py", line 119, in _create_code_model
    code_model.format_lro_operations()
  File "/root/.autorest/@[email protected]/node_modules/@autorest/python/autorest/codegen/models/code_model.py", line 175, in format_lro_operations
    operation.set_lro_response_type()
  File "/root/.autorest/@[email protected]/node_modules/@autorest/python/autorest/codegen/models/lro_operation.py", line 72, in set_lro_response_type
    f" method {self.python_name} and none of them have a 200 status code."
ValueError: Your swagger is invalid because you have multiple response schemas for LRO method delete and none of them have a 200 status code.
Failure during batch task - {"tag":"package-2020-03"} -- Error: Plugin codegen reported failure..
  Error: Plugin codegen reported failure.

I guess that it may be an error in codegen, because it worked after I deleted 200 or 404 in responses.
https://github.com/Azure/azure-rest-api-specs/blob/master/specification/iothub/resource-manager/Microsoft.Devices/stable/2020-03-01/iothub.json#L286

waiting for you answer :)

@iscai-msft
Copy link
Contributor

iscai-msft commented Nov 9, 2020 via email

@iscai-msft
Copy link
Contributor

hey @00Kai0, @lmazuel correctly pointed out that your 404 error response is not actually marked as an error response. In cases where you have different sections for different error codes, you need to mark the error definition with an [x-ms-error-response(https://github.com/Azure/autorest/blob/master/docs/extensions/readme.md#x-ms-error-response) (see link for more info), to let autorest know that this is an error we should be returning.

So in conclusion, there are 2 errors going on here: one is on our side, and one is on your side. We have a PR out for our side, can you fix your swagger error as well?

@00Kai0
Copy link
Author

00Kai0 commented Nov 11, 2020

Hi @iscai-msft. Sure, I will. thx ;)

@iscai-msft
Copy link
Contributor

@00Kai0 we've released a fix with this, version 5.4.3. Ruingn --v3 --python on the command line should get you this version. If not, run an autorest --reset

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 a pull request may close this issue.

3 participants