Skip to content

Encode any Enums in Routing Header as an Int #1966

@lqiu96

Description

@lqiu96

See go/clientlibs-routine-headers-numeric-enums for more information.

Enums in every implicit/ explicit routing header should be encoded as an Int.

The Routing Headers seem to be encoded here via a ParamsExtractor.
Example:

.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})

This should be modified to get the Int value instead.

Generator changes:
Affect the AbstractTransportServiceStubClassComposer. Specifically around:

if (method.routingHeaderRule() == null) {
createRequestParamsExtractorBodyForHttpBindings(
method, requestVarExpr, bodyStatements, returnExpr);
} else {
createRequestParamsExtractorBodyForRoutingHeaders(
method, requestVarExpr, classStatements, bodyStatements, returnExpr);
}

Both methods should be modified so that the changes are applied for both implicit and explicit routing headers.

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions