Skip to content
This repository was archived by the owner on Aug 8, 2018. It is now read-only.
This repository was archived by the owner on Aug 8, 2018. It is now read-only.

"Invalid Mapping Expression Parameter" Error Thrown on method.request.path when Importing RAML with Nested uriParameters #197

@kyarosh

Description

@kyarosh

If a RAML API definition contains a resource that requires URI parameters to be defined, and if that resource contains nested resources, creation of the integration request for the nested resource fails with the following error:
Invalid mapping expression parameter specified: method.request.path.PARAMETER

For example, if an API has the following three resources, importing the third one will throw an error about method.request.path.accountId:

  • /accounts
  • /accounts/{accountId}
  • /accounts/{accountId}/users

This occurs because, while RAML defines nested resources as hierarchical components (e.g., /accounts is a parent of /{accountId} is a parent of /users), API Gateway treats the resources as independent. As a result, a URI parameter defined for a resource in RAML is inherited by the resource's children, but in API Gateway the parameter must be explicitly defined for each child resource when the resource methods are created/updated. However, since ApiGatewaySdkRamlApiImporter.createMethod() only loops through URI parameters explicitly defined in the RAML for the current resource (and not its parents), parent parameters are never defined. In the above example, this means that "accountId" is defined for /accounts/{accountId} but not /accounts/{accountId}/users, which causes API Gateway to thrown an error when trying to create the integration request for /accounts/{accountId}/users.

I have a proposed fix for this for which I'll be submitting a pull request shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions