Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone grpc extension transforms message keys to camel case #137

Open
cadabrum opened this issue Feb 6, 2025 · 1 comment
Open

Standalone grpc extension transforms message keys to camel case #137

cadabrum opened this issue Feb 6, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@cadabrum
Copy link

cadabrum commented Feb 6, 2025

Proposal

wiremock-grpc-extension transforms snake case message keys to camel case

Reproduction steps

container: wiremock:3.9.1
wiremock-grpc-extension-standalone-0.8.1.jar

version:                      3.9.1
port:                         8080
enable-browser-proxying:      false
disable-banner:               false
no-request-journal:           false
verbose:                      false
 
extensions:                   grpc-admin-api,grpc,response-template,webhook

Messages defined in proto file:

message MyRequest {
    string job_id = 1;
}

message MyResponse {
    string job_id = 1;
}

stub:

    "response": {
        "status": 200,
        "body": "{\"job_id\": \"{{jsonPath request.body '$.jobId'}}\"}",
        "transformers": ["response-template"]
    }

grpcurl request:

grpcurl -d '{"job_id": "job_123" }' ...

Wiremock __admin/requests values:

request:
"body" : "{\n  \"jobId\": \"job_123\"\n}",

response:
      "body" : "{\"job_id\": \"job_123\"}"

Actual response body displayed by grpcurl:

{
  "jobId": "job_123"
}

References

No response

@cadabrum cadabrum added the bug Something isn't working label Feb 6, 2025
@cadabrum
Copy link
Author

cadabrum commented Feb 7, 2025

This behavior can be fixed using json_name annotations, not sure if this is the expected behavior by design.
WA also fixes response-template issue, when user had to use camel case in templates.

string job_id = 1 [json_name = "job_id"];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant