Skip to content

Commit

Permalink
Fix key sort (microsoft#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamurshe authored Feb 27, 2020
1 parent 66bc893 commit 1d34f09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/paconn-cli/paconn/common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ def display(txt):
print(txt, file=sys.stderr)


def format_json(content):
def format_json(content, sort_keys=False):
"""
Format a given dictionary to a json formatted string.
"""
json_string = json.dumps(
content,
sort_keys=True,
sort_keys=sort_keys,
indent=2,
separators=(',', ': '))
return json_string
Expand Down
12 changes: 10 additions & 2 deletions tools/paconn-cli/paconn/operations/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ def download(powerapps_rp, settings, destination, overwrite):
}

# Write the api properties
api_prop = format_json(api_properties_selected)
api_prop = format_json(
content=api_properties_selected,
sort_keys=False)

open(
file=settings.api_properties,
mode='w'
Expand All @@ -132,7 +135,11 @@ def download(powerapps_rp, settings, destination, overwrite):
original_swagger_url = api_properties[_API_DEFINITIONS][_ORIGINAL_SWAGGER_URL]
response = requests.get(original_swagger_url, allow_redirects=True)
response_string = response.content.decode('utf-8-sig')
swagger = format_json(json.loads(response_string))

swagger = format_json(
content=json.loads(response_string),
sort_keys=False)

open(
file=settings.api_definition,
mode='w'
Expand All @@ -142,6 +149,7 @@ def download(powerapps_rp, settings, destination, overwrite):
if _ICON_URI in api_properties:
icon_url = api_properties[_ICON_URI]
response = requests.get(icon_url, allow_redirects=True)

open(
file=settings.icon,
mode='wb'
Expand Down

0 comments on commit 1d34f09

Please sign in to comment.