Skip to content

Commit

Permalink
fix: fix issue when referencing RestApiId by Ref (#1396)
Browse files Browse the repository at this point in the history
This handles the error of when referencing an API via Ref so that the dictionary check actually occurs. This makes the type checks equivalent and isn't as restrictive as the OrderedDict class
  • Loading branch information
patrickgreenwell authored and keetonian committed Jan 28, 2020
1 parent 47c5d7a commit 66e3d70
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions samtranslator/translator/translator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import copy
from samtranslator.model import ResourceTypeResolver, sam_resources
from collections import OrderedDict
from samtranslator.translator.verify_logical_id import verify_unique_logical_id
from samtranslator.model.preferences.deployment_preference_collection import DeploymentPreferenceCollection
from samtranslator.model.exceptions import (
Expand Down Expand Up @@ -52,7 +51,7 @@ def _get_function_names(self, resource_dict, intrinsics_resolver):
# adds to the function_names dict with key as the api_name and value as the function_name
if item.get("Type") == "Api" and item.get("Properties") and item.get("Properties").get("RestApiId"):
rest_api = item.get("Properties").get("RestApiId")
if type(rest_api) == dict or isinstance(rest_api, OrderedDict):
if type(rest_api) == dict or isinstance(rest_api, dict):
api_name = item.get("Properties").get("RestApiId").get("Ref")
else:
api_name = item.get("Properties").get("RestApiId")
Expand Down

0 comments on commit 66e3d70

Please sign in to comment.