Repository navigation
Conversation
|
I may be wrong but does it not miss a test with CORS enabled but without the DefinitionBody ? |
|
Any news on this @NickHeap2 ? |
|
@aleguern last time after a week the bot applied the maintainer/need-response tag and then it got reviewed. |
torresxb1
left a comment
There was a problem hiding this comment.
Thank you very much for your contribution!
Left a couple comments. Also, this is more of a nit, but could we make the names of tests/files specific (e.g. ...definition_body_include_local_path, ...definition_body_include_non_string, etc.)? Oh and, replacing none_string with non_string 🙏 🙏
| --- | ||
| openapi: 3.0.0 | ||
| paths: | ||
| /test: | ||
| get: | ||
| summary: Get test |
There was a problem hiding this comment.
is this file needed, given that the template points to an intrinsic (which also resolves to s3 uri) and not a local file path?
There was a problem hiding this comment.
I left it in to make it clear that the test doesn't do the replace because it's not a simple string rather than because openapi.yaml doesn't exist. Will take it out though.
| ("openapi_yaml", TemplateFileTypes.YAML), # project with template.yaml | ||
| ("openapi_json", TemplateFileTypes.JSON), # project with template.json | ||
| ("include_none_string", TemplateFileTypes.YAML), # project with template.yaml and none string include |
There was a problem hiding this comment.
not sure if we should be adding these here. Seems like this test was meant for the default template (at least going by the name of the test), and also wouldn't these new tests be better suited for the functional tests like the other one you added (explicit_http_api_minimum_include.yaml) ?
@jfuss thoughts? (you had previously reviewed this PR but it got reverted and now this one addresses the issue)
| resource_property_dict[property_key] = s3_uri_value | ||
|
|
||
| @staticmethod | ||
| def _replace_with_file_contents(resource_property_dict, location_prop): |
There was a problem hiding this comment.
The name of the method seems generic but what it does is specific to API. Can you make the implementation generic?
There was a problem hiding this comment.
Please add in docstring to this method as well as input parameter type hints!
| --- | ||
| openapi: 3.0.0 | ||
| paths: | ||
| /test: | ||
| get: | ||
| summary: Get test |
|
|
||
| self.assertEqual(expected, result) | ||
|
|
||
| def test_payload_format_version_for_none(self): |
There was a problem hiding this comment.
Why is this test relevant to the change?
|
Hi @NickHeap2 would you be able to address the change requests? |
|
Closing as inactive. Happy to review an updated PR from the community, if someone wants to revive the PR |
Which issue(s) does this change fix?
#3041
#3676
Why is this change necessary?
If you are using OpenAPI yaml specifications it makes sense to use them for the API DefinitionBody like this:
Whilst this is valid in a template it is currently not supported by sam validate.
How does it address the issue?
This change detects this pattern and replaces the DefinitionBody with the actual contents of the file allowing the validation to succeed.
This PR also includes tests to make sure that it copes with Locations that are not strings as per #3676.
What side effects does this change have?
Potentially someone could be relying on the existing behaviour where it fails for this pattern to prevent that pattern being used.
Checklist
make prpassesmake update-reproducible-reqsif dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.