Nagaraj Thirunavukkarasu
06/11/2025, 4:33 PMINSML-VJD2V5L9 shared-service-wiremock % docker run -p 8080:8080 -p 8081:8080 my-grpc-wiremock-simulator
Jun 11, 2025 4:23:37 PM wiremock.com.google.protobuf.Descriptors$DescriptorPool lookupSymbol
WARNING: The descriptor for message type ".google.protobuf.Struct" cannot be found and a placeholder is created for it
Jun 11, 2025 4:23:37 PM wiremock.com.google.protobuf.Descriptors$DescriptorPool lookupSymbol
WARNING: The descriptor for message type ".google.protobuf.Empty" cannot be found and a placeholder is created for it
██ ██ ██ ██████ ███████ ███ ███ ██████ ██████ ██ ██
██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██
██ █ ██ ██ ██████ █████ ██ ████ ██ ██ ██ ██ █████
██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███ ███ ██ ██ ██ ███████ ██ ██ ██████ ██████ ██ ██
----------------------------------------------------------------
| Cloud: <https://wiremock.io/cloud> |
| |
| Slack: <https://slack.wiremock.org> |
----------------------------------------------------------------
version: 3.13.0
port: 8080
enable-browser-proxying: false
disable-banner: false
no-request-journal: false
verbose: false
extensions: grpc,response-template,webhook
I have created stub also like this
{
"request": {
"method": "POST",
"url": "/crdcagent.v1.CrdcAgentCrudService/CreateCrd",
"headers": {
"Content-Type": {
"matches": "application/grpc.*"
}
},
"bodyPatterns": [
{
"equalToJson": {
"name": "my-new-crd",
"version": "v1",
"plural": "mycrds",
"crdData": {
"kind": "MyCrd",
"apiVersion": "v1alpha1",
"spec": {
"groups": [
"group1"
],
"versions": [
{
"name": "v1",
"served": true,
"storage": true
}
],
"scope": "Namespaced",
"validation": {
"openAPIV3Schema": {
"type": "object",
"properties": {
"spec": {
"type": "object",
"properties": {
"minReplicas": {
"type": "integer",
"minimum": 1
}
}
}
}
}
}
}
},
"updateIfExist": true
},
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
]
},
"response": {
"status": 200,
"jsonBody": {},
"headers": {
"Content-Type": "application/grpc",
"grpc-status": "0"
}
}
}
When i trigger grpccurl
grpcurl -plaintext \
-proto crdcagent.proto \
-d '{
"name": "my-new-crd",
"version": "v1",
"plural": "mycrds",
"crdData": {
"kind": "MyCrd",
"apiVersion": "v1alpha1",
"spec": {
"groups": ["group1"],
"versions": [
{"name": "v1", "served": true, "storage": true}
],
"scope": "Namespaced",
"validation": {
"openAPIV3Schema": {
"type": "object",
"properties": {
"spec": {
"type": "object",
"properties": {
"minReplicas": {
"type": "integer",
"minimum": 1
}
}
}
}
}
}
}
},
"updateIfExist": true
}' \
localhost:8080 crdcagent.v1.CrdcAgentCrudService/CreateCrd
Getting this exception
Exception in thread "grpc-default-executor-3" wiremock.com.google.protobuf.InvalidProtocolBufferException: Invalid Struct type.
at wiremock.com.google.protobuf.util.JsonFormat$PrinterImpl.printStruct(JsonFormat.java:924)
at wiremock.com.google.protobuf.util.JsonFormat$PrinterImpl.access$1500(JsonFormat.java:685)
at wiremock.com.google.protobuf.util.JsonFormat$PrinterImpl$6.print(JsonFormat.java:811)
at wiremock.com.google.protobuf.util.JsonFormat$PrinterImpl.print(JsonFormat.java:737)
at wiremock.com.google.protobuf.util.JsonFormat$PrinterImpl.printSingleFieldValue(JsonFormat.java:1242)
at wiremock.com.google.protobuf.util.JsonFormat$PrinterImpl.printSingleFieldValue(JsonFormat.java:1107)
at wiremock.com.google.protobuf.util.JsonFormat$PrinterImpl.printField(JsonFormat.java:1032)
at wiremock.com.google.protobuf.util.JsonFormat$PrinterImpl.print(JsonFormat.java:1010)
at wiremock.com.google.protobuf.util.JsonFormat$PrinterImpl.print(JsonFormat.java:740)
at wiremock.com.google.protobuf.util.JsonFormat$Printer.appendTo(JsonFormat.java:344)
at wiremock.com.google.protobuf.util.JsonFormat$Printer.print(JsonFormat.java:354)
at org.wiremock.grpc.internal.JsonMessageConverter.lambda$toJson$0(JsonMessageConverter.java:35)
at com.github.tomakehurst.wiremock.common.Exceptions.uncheck(Exceptions.java:64)
at org.wiremock.grpc.internal.JsonMessageConverter.toJson(JsonMessageConverter.java:35)
at org.wiremock.grpc.internal.UnaryServerCallHandler.invoke(UnaryServerCallHandler.java:55)
at org.wiremock.grpc.internal.UnaryServerCallHandler.invoke(UnaryServerCallHandler.java:33)
at wiremock.grpc.io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
at wiremock.grpc.io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
at wiremock.grpc.io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
at wiremock.grpc.io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
at wiremock.grpc.io.grpc.Contexts$ContextualizedServerCallListener.onHalfClose(Contexts.java:86)
at wiremock.grpc.io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:356)
at wiremock.grpc.io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:861)
at wiremock.grpc.io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at wiremock.grpc.io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Could you please suggest proper version for GRPC extension with google protobuf?Lee Turner
06/11/2025, 4:53 PMNagaraj Thirunavukkarasu
06/11/2025, 4:56 PMprotoc \
--proto_path=. \
--proto_path=$(YOUR_PROTOBUF_INCLUDE_PATH) \
--descriptor_set_out=crdcagent.desc \
--include_imports \
crdcagent.proto
my proto
// [START declaration]
syntax = "proto3";
package crdcagent.v1;
// [END declaration]
// [START go_declaration]
option go_package = "crdcagent/pb";
// [END go_declaration]
// [START java_declaration]
option java_multiple_files = true;
option java_package = "crdcagent.grpc.pb";
option java_outer_classname = "CrdcAgentProto";
// [END java_declaration]
// [START imports]
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
// [END imports]
service CrdcAgentCrudService {
rpc CreateCrd(CreateCrdRequest) returns (google.protobuf.Empty) {}
rpc ReadCrd(ReadCrdRequest) returns (ReadCrdResponse) {}
rpc UpdateCrd(UpdateCrdRequest) returns (google.protobuf.Empty) {}
rpc DeleteCrd(DeleteCrdRequest) returns (google.protobuf.Empty) {}
}
// RPC to initiate Create CRD
// Return Status code and details indicating operation result
message CreateCrdRequest {
//name of the crd
string name = 1;
//version number in ConfigGenVersion field
string version = 2;
string plural = 3;
//full crd data
google.protobuf.Struct crd_data = 4;
// if crd exists, updates it otherwise creates crd
bool update_if_exist = 5;
}
// RPC to initiate Update CRD
// Return Status code and details indicating operation result
message UpdateCrdRequest {
//name of the crd
string name = 1;
//version number in ConfigGenVersion field
string version = 2;
string plural = 3;
//full crd data
google.protobuf.Struct crd_data = 4;
// if crd does not exist, creates it otherwise updates it
bool create_if_not_exist = 5;
}
message DeleteCrdRequest {
// name of the crd to delete
string name = 1;
string plural = 2;
}
// RPC to initiate Read CRD
// Return Status code and details indicating operation result
message ReadCrdRequest {
// name of the crd to delete
string name = 1;
string plural = 2;
}
message ReadCrdResponse {
// spec of the crd
google.protobuf.Struct crd_data = 1;
}
Nagaraj Thirunavukkarasu
06/11/2025, 4:59 PMLee Turner
06/12/2025, 7:56 AMLee Turner
06/12/2025, 7:57 AMNagaraj Thirunavukkarasu
06/13/2025, 7:09 AMLee Turner
06/13/2025, 8:16 AM