From b3aeee1e5db842b91750c70c1727f141e9f68733 Mon Sep 17 00:00:00 2001 From: Aleksander Lorenc Date: Tue, 7 Apr 2020 00:15:11 +0200 Subject: [PATCH] Includes a fix for request params. --- aws_openapi_lint/rules/PathParamNotMappedRule.py | 8 +++++++- setup.py | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/aws_openapi_lint/rules/PathParamNotMappedRule.py b/aws_openapi_lint/rules/PathParamNotMappedRule.py index 42530e1..4f7f9f1 100644 --- a/aws_openapi_lint/rules/PathParamNotMappedRule.py +++ b/aws_openapi_lint/rules/PathParamNotMappedRule.py @@ -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 @@ -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, diff --git a/setup.py b/setup.py index eac7ac8..78b09dd 100644 --- a/setup.py +++ b/setup.py @@ -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',