Deploy validation binary types.
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
What is the goal of this function?
Is `AWS API Gateway` will be broken without this validation?
And how to configure `AWS API Gateway` to enabling binary support like in docs https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings-configure-with-console.html
https://github.com/aws/chalice/blob/master/chalice/deploy/validate.py#L147
```python
def _validate_entry_content_type(route_entry, binary_types):
# type: (app.RouteEntry, List[str]) -> None
binary, non_binary = [], []
for content_type in route_entry.content_types:
if content_type in binary_types:
binary.append(content_type)
else:
non_binary.append(content_type)
if binary and non_binary:
# A routes content_types be homogeneous in their binary support.
raise ValueError(
'In view function "%s", the content_types %s support binary '
'and %s do not. All content_types must be consistent in their '
'binary support.' % (route_entry.view_name, binary, non_binary))
```
I think we can have endpoints which accepts binary and not binary content-types.
```python
app.api.binary_types.append("multipart/form-data")
@app.route(
"/graphql",
methods=["POST"],
content_types=[
"application/json",
"multipart/form-data",
],
)
@shutdown_request
def graphql():
pass
```
Contributor guide
Research direction
Start with chalice/deploy/validate.py at _validate_entry_content_type and read the linked AWS API Gateway binary payload encoding documentation. Trace how route_entry.content_types and app.api.binary_types are deployed, then determine whether mixed binary and non-binary content types are supported. Done means the expected behavior and any required validation changes are confirmed with regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- api, backend, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100