Skip to content

Commit

Permalink
generate_sdk pin stable version (#16799)
Browse files Browse the repository at this point in the history
  • Loading branch information
msyyc authored Feb 18, 2021
1 parent 14eb6f7 commit 7857577
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ def build_swaggertosdk_conf_from_json_readme(readme_file, sdk_git_id, config, ba
with tempfile.TemporaryDirectory() as temp_dir:
readme_as_conf = autorest_swagger_to_sdk_conf(
readme_full_path,
temp_dir
temp_dir,
config
)
generated_config = {
"markdown": readme_full_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ def autorest_latest_version_finder():
return json.loads(subprocess.check_output(cmd_line.split()).decode().strip())


def autorest_swagger_to_sdk_conf(readme, output_folder):
def autorest_swagger_to_sdk_conf(readme, output_folder, config):
_LOGGER.info("Looking for swagger-to-sdk section in {}".format(readme))
autorest_bin = shutil.which("autorest")
# --input-file=foo is to workaround a bug where the command is not executed at all if no input-file is found (even if we don't care about input-file here)
cmd_line = "{} {} --perform-load=false --swagger-to-sdk --output-artifact=configuration.json --input-file=foo --output-folder={}".format(
cmd_line = "{} {} --perform-load=false --swagger-to-sdk --output-artifact=configuration.json --input-file=foo --output-folder={} --version={}".format(
autorest_bin,
str(readme),
str(output_folder)
str(output_folder),
str(config['meta']['autorest_options']['version'])
)
execute_simple_command(cmd_line.split())
conf_path = Path(output_folder, "configuration.json")
Expand Down

0 comments on commit 7857577

Please sign in to comment.