-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Labels
bugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.p0
Description
Summary:
When autorest is executed with `two times, the generated init.py file in the namespace directory does not have the expected content and differs from the content which was generated in the first time.
Test Environment:
- Windows 10
- AutoRest code generation utility [cli version: 3.0.6187; node: v12.16.1, max-memory: 8192 gb]
- Loading AutoRest extension '@autorest/python' (5.0.0-preview.8->5.0.0-preview.8) (
--use=@autorest/[email protected]option was used)
Details
-
Get petstore.yaml file from https://github.com/Azure/autorest/blob/master/Samples/openapi-v3/1a-code-generation-minimal/petstore.yaml
-
Execute the following command:
autorest --input-file=petstore.yaml --python --output-folder=petstore --namespace=azure.mgmt.petstore --azure-arm=true --use=@autorest/[email protected] --package-version=0.2 --basic-setup-py=true
The content of the petstore/azure/mgmt/petstore/__init__.py file is:
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._swagger_petstore import SwaggerPetstore
from ._version import VERSION
__version__ = VERSION
__all__ = ['SwaggerPetstore']
try:
from ._patch import patch_sdk
patch_sdk()
except ImportError:
pass- Execute the same command again. The content has changed:
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore-----------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from ._swagger_petstore import SwaggerPetstore
from ._version import VERSION
__version__ = VERSION
__all__ = ['SwaggerPetstore']
try:
from ._patch import patch_sdk
patch_sdk()
except ImportError:
passOne can see that the first line has been overwritten.
Additional information
- I have tried with various OpenAPI files and with different options (with and without
--basic-setup-pyoption, the result is the same. - I have tried with and without
--clear-output-folder=true, the result is the same. - If I manually delete the output folder, the next generation is good again. (However, this is tricky because if VS Code was open, despite the folder deletion, the next generation was wrong again. This is magic, I know, could not find the real root cause here.)
- If I delete only the
__init__.pyfile, the next generation is wrong again! - No other
__init__.pyfile has the same issue, only the one which is in the namespace folder.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.p0