Skip to content

Commit

Permalink
Includes a fix for request params.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Lorenc committed Apr 6, 2020
1 parent 94ba488 commit b3aeee1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion aws_openapi_lint/rules/PathParamNotMappedRule.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from functools import reduce

from .rule_validator import RuleViolation
from .rules_helper import find_path_params, contains_apigateway_integration, contains_request_parameters, \
get_apigateway_integration, get_path_verbs
Expand Down Expand Up @@ -27,9 +29,13 @@ def validate(self, spec):
continue

request_params = integration['requestParameters']
request_params_values = request_params.values()

request_params_last = [value.split('.')[-1:] for value in request_params_values]
request_params_last = reduce(lambda x, y: x+y, request_params_last)

for path_param in all_path_params:
if "integration.request.path.%s" % path_param not in request_params:
if path_param not in request_params_last:
message = 'Path parameter "{}" was not mapped in `requestParameters`.'.format(path_param)
violations.append(RuleViolation('path_parameter_not_mapped',
message=message,
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

setup(
name='AWS-OpenAPI-Lint',
version='0.2.1',
version='0.2.2',
url='https://github.com/evilmint/aws-openapi-lint',
download_url='https://github.com/evilmint/aws-openapi-lint/archive/0.2.0.tar.gz',
download_url='https://github.com/evilmint/aws-openapi-lint/archive/0.2.2.tar.gz',
description='AWS API Gateway OpenAPI spec linter',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit b3aeee1

Please sign in to comment.