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

Binary media types bug fix #1043

Merged
merged 3 commits into from
Jul 26, 2019
Merged

Conversation

keetonian
Copy link
Contributor

Issue #, if available:
#1036

Description of changes:
Converts ~1 to /, as is expected in the swagger for binary media types.

The CloudFormation property expects ~1. Docs: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-binarymediatypes

The Swagger property expects /. Docs: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-binary-media-types.html

Description of how you validated changes:
Tests updated and pass.

Checklist:

  • Write/update tests
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@keetonian keetonian changed the title Binary media types Binary media types bug fix Jul 25, 2019
@codecov-io
Copy link

codecov-io commented Jul 25, 2019

Codecov Report

Merging #1043 into develop will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1043      +/-   ##
===========================================
+ Coverage    94.82%   94.82%   +<.01%     
===========================================
  Files           69       69              
  Lines         3244     3248       +4     
  Branches       632      632              
===========================================
+ Hits          3076     3080       +4     
  Misses          87       87              
  Partials        81       81
Impacted Files Coverage Δ
samtranslator/model/sam_resources.py 95.62% <100%> (+0.02%) ⬆️
samtranslator/swagger/swagger.py 97.5% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0712837...9a67613. Read the comment docs.

@@ -257,7 +258,8 @@ def add_cors(self, path, allowed_origins, allowed_headers=None, allowed_methods=
allow_credentials)

def add_binary_media_types(self, binary_media_types):
self._doc[self._X_APIGW_BINARY_MEDIA_TYPES] = binary_media_types
bmt = json.loads(json.dumps(binary_media_types).replace('~1', '/'))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dump it into json so all nested lists and dictionaries are expressed as a string, replace the ~1 with /, and then load back into data form.

@praneetap praneetap merged commit 7fd10a7 into aws:develop Jul 26, 2019
keetonian added a commit that referenced this pull request Jul 26, 2019
@keetonian keetonian mentioned this pull request Aug 6, 2019
@keetonian keetonian deleted the binary-media-types branch August 17, 2019 06:13
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 this pull request may close these issues.

None yet

4 participants