mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
CreateIntegration, UpdateIntegration, GetIntegration(s), OpenAPI import and
AWS::ApiGatewayV2::Integration now carry IntegrationSubtype. A subtype is
accepted only on an HTTP API AWS_PROXY integration with payload format 1.0
(the default when a subtype is set), and its RequestParameters must map every
required member of the action and nothing it does not take. SQS-SendMessage is
the supported subtype. The JSON 1.1 path keeps RequestParameters keys as sent,
since subtype parameters are PascalCase member names.
An HTTP API route whose AWS_PROXY integration has an IntegrationSubtype now
runs that AWS service action instead of resolving a Lambda function from the
integration URI. RequestParameters are mapped at invoke time: static values,
whole expressions such as $request.body, $request.body.<JSONPath>,
$request.header/querystring/path, $context and $stageVariables, and
expressions embedded as ${request.header.X}. Region selects the action's
region. A required parameter that maps to nothing answers 400
MissingParameter. The response is 200 with the action's result in the
<Action>Response/<Action>Result envelope; an action error keeps its status.
Lambda AWS_PROXY and HTTP_PROXY dispatch are unchanged.
Every subtype AWS defines is now known, with its required and optional parameters from the AWS reference, so create and update validate all of them instead of rejecting the ones Floci does not invoke. Only SQS-SendMessage carries a service action.
The subtype check is a package-private static method, and OpenAPI import and reimport run it over every x-amazon-apigateway-integration while planning, before any route or integration is deleted or created.
$request.body.<path> read a scalar through json-path as a JsonNode and threw ClassCastException, which escaped as a 500. The value is now read as an Object and converted, and resolution runs inside the dispatch error handling.
MessageAttributes and MessageSystemAttributes are parsed as JSON templates first and expressions are resolved only inside their string values, so a header holding quotes or braces stays one literal string instead of adding attributes.
Subtype parameters also resolve accountId, apiId, domainName, httpMethod, path, requestTime, requestTimeEpoch, routeKey and stage from $context. A subtype without a service action answers 500 at invoke.
UpdateIntegration keeps a field the request leaves out, so an AWS::ApiGatewayV2::Integration update that drops IntegrationSubtype kept the old one. The provisioner now clears it explicitly, records the prior subtype in the rollback snapshot and restores it when the update fails.
A number or boolean value is read as its text, and an object or array value is a 400 BadRequestException instead of an unchecked conversion error.
Adds invoke cases for $request.body.<field>, a header that tries to break out of its MessageAttributes value, and $context variables; a stored-but-not-invoked SQS-PurgeQueue integration; a reimport with an invalid subtype that leaves the API unchanged; and number and object RequestParameters values on the JSON protocol. Queue creation now sits inside the cleanup block.
A MessageAttributes or MessageSystemAttributes value that does not parse as a JSON object was interpolated as raw text, so a request value could add or change members of the attributes object. It is now an InvalidParameterValue 400; whole source expressions such as $request.body.attributes or ${request.body.attributes} still resolve as before.
- A required parameter mapped to null or a blank string is rejected like a missing one.
- A MessageAttributes or MessageSystemAttributes value must be a JSON object or a source expression.
- Number and boolean RequestParameters values sent to the REST endpoints are read as text, and object or array values are a 400 instead of a ClassCastException.
- UpdateIntegration that adds a subtype to an integration without one, and sends no PayloadFormatVersion, stores 1.0 as CreateIntegration does.
- The create, update and OpenAPI import paths share one payload format default.
- $context.requestId is the request's gateway id, honouring a valid x-amzn-RequestId override, instead of a fresh UUID.
- $context.domainName is the Host the request arrived on, falling back to the execute-api host, and $context.domainPrefix, extendedRequestId and protocol resolve.
- $context.path carries the stage prefix for a named stage, as HTTP API authorizer identity sources do.
- An integration without a Region parameter calls the service in the API's region, or the default region when the request carried none.
An x-amazon-apigateway-integration in an AWS::ApiGatewayV2::Api Body dropped integrationSubtype and requestParameters, so the API was created with a plain AWS_PROXY integration that never reached the service action. Both are now passed to CreateIntegration, which validates them as it does for every other caller. The PayloadFormatVersion default for AWS::ApiGatewayV2::Integration uses the shared helper.
The rollback snapshot restored the subtype only when the integration had one, so a failed update that added a subtype left it in place. The snapshot's subtype is now restored as recorded, null included, and a subtype change no longer marks the update as one whose other fields cannot be rolled back.
The template reader now fails on trailing tokens, so a value such as {"a":1} trailing no longer passes CreateIntegration and then has its tail dropped. The call-time check on a resolved JSON parameter uses the same reader instead of the application ObjectMapper, so create and invoke accept the same values.
A parameter value starting with $ was taken as an expression even when it named no source, such as "$5 off" or the typo $request.heder.x, so it passed CreateIntegration and resolved to nothing on every call. CreateIntegration, UpdateIntegration and OpenAPI import now answer it with a BadRequestException. The accepted sources are $request.header., $request.querystring., $request.path., $request.body and $request.body., $context. and $stageVariables., checked for a whole-value expression, each embedded ${...} expression, and the string values of a JSON parameter's object. A $ elsewhere in a value stays static text, so mixed templates are unchanged.
UpdateIntegration replaced RequestParameters wholesale, so an update that
set one optional parameter on an SQS-SendMessage integration dropped
QueueUrl and MessageBody and then failed the required-parameter check.
AWS merges: a named key is added or replaced, a key sent as an empty
string is removed, and an omitted key is kept. The merge applies to every
HTTP API integration, and the subtype check runs on the merged map.
The AWS::ApiGatewayV2::Api Body path passed requestParameters through as
objects, so an object-valued MessageAttributes was rejected as not a
string. It now reads every value with the importer's own conversion: a
number or boolean as its text, and an object or array as its JSON text.
A whitespace-only value is a valid SQS message body, and how API Gateway
treats one is unmeasured, so create now applies the same isEmpty check
invoke does instead of rejecting blank values.
ApiGatewayV2Service.stringParameters already reads number and boolean values as text and rejects object and array values, so the handler no longer converts them too.