Files
floci/src/main/java/io/github/hectorvent
Ovidiu (Ovi) ce5c5b4cfa fix(apigateway): reject method request parameter names AWS refuses (#3549)
* fix(apigateway): reject method request parameter names AWS refuses

API Gateway restricts a method request parameter name to
^[a-zA-Z0-9:._$-]+$. floci applied no validation, so a spec that real AWS
refuses imported cleanly against the emulator and only failed on deploy,
which is the direction that costs the most to discover.

The limitation is undocumented. Measured against real AWS (us-west-2),
both entry points reject a name outside the set:

  PutMethod
    BadRequestException: Invalid mapping expression specified:
    Validation Result: warnings : [], errors : [Parameter name should
    match the following regular expression: ^[a-zA-Z0-9:._$-]+$]

  ImportRestApi
    BadRequestException: Errors found during import:	Unable to put
    method 'GET' on resource at path '/items': <the message above>

$ : . _ - are inside the set, so a JSON:API style filter[a] cannot be
imported while filter.a can, which is the workaround applications adopt.
The rule covers query string, header and path parameters alike, and
applies whether or not the parameter is required.

Validation lives in putMethod, the choke point both entry points share.
The import path rethrows it under the envelope AWS uses there, naming the
method and resource path.

Only the declared name is restricted. At runtime a request carrying
?filter[a]=1 reaches a proxy integration with the brackets intact, so
this is not a general ban on the character in a query string, and nothing
on the execute path changes.

* docs(apigateway): attach the parameter-name javadoc to the method it describes

The javadoc for validateRequestParameterNames sat above
importParameterNameFailure, which carried its own javadoc directly
beneath it. Move it down onto the method it documents.

No behavior change.
2026-09-15 12:56:40 -04:00
..