{"id":50874245,"url":"https://github.com/wiremock/protobuf-extension-example","last_synced_at":"2026-06-15T08:04:07.083Z","repository":{"id":354808359,"uuid":"1219049483","full_name":"wiremock/protobuf-extension-example","owner":"wiremock","description":"An example WireMock extension to encode/decode protobuf request/responses (non-gRPC)","archived":false,"fork":false,"pushed_at":"2026-04-30T06:48:28.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-30T08:20:37.807Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wiremock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T13:31:20.000Z","updated_at":"2026-04-30T06:48:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wiremock/protobuf-extension-example","commit_stats":null,"previous_names":["wiremock/protobuf-extension-example"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/wiremock/protobuf-extension-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiremock%2Fprotobuf-extension-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiremock%2Fprotobuf-extension-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiremock%2Fprotobuf-extension-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiremock%2Fprotobuf-extension-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wiremock","download_url":"https://codeload.github.com/wiremock/protobuf-extension-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiremock%2Fprotobuf-extension-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34353196,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-15T08:04:06.104Z","updated_at":"2026-06-15T08:04:07.078Z","avatar_url":"https://github.com/wiremock.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WireMock Protobuf Extension\n\nA [WireMock](https://wiremock.org/) extension that adds Protocol Buffers support, allowing you to stub and verify protobuf-encoded HTTP APIs using familiar JSON matching.\n\n## How it works\n\nThe extension automatically:\n\n1. **Decodes** incoming protobuf request bodies into JSON so you can use WireMock's standard JSON matchers (`equalToJson`, `matchingJsonPath`, etc.)\n2. **Encodes** JSON response bodies back into protobuf wire format when the request has a protobuf content type\n\nRequests with `Content-Type: application/x-protobuf` or `application/protobuf` are processed. All other requests pass through unmodified.\n\n## Prerequisites\n\n- Java 17+\n- WireMock 4.x\n\n## Building\n\n```bash\n./gradlew shadowJar\n```\n\nThe shadow JAR at `build/libs/wiremock-protobuf-extension-\u003cversion\u003e-all.jar` includes protobuf and all its transitive dependencies, shaded to avoid classpath conflicts.\n\n## Usage\n\n### Adding the extension\n\nPlace the shadow JAR on WireMock's classpath. The extension is loaded automatically via `ExtensionFactory` service loading.\n\nOr register it programmatically:\n\n```java\nWireMockServer wm = new WireMockServer(\n    wireMockConfig()\n        .extensions(new ProtobufExtensionFactory())\n);\n```\n\n### Defining your protobuf schema\n\nPlace your `.proto` files in `src/main/proto`. The build generates a descriptor set at `protobuf/descriptor.desc` which the extension uses at runtime to dynamically parse messages.\n\n### Stubbing\n\nDefine stubs with JSON bodies as normal -- the extension handles the protobuf encoding:\n\n```java\nstubFor(\n    post(urlPathEqualTo(\"/api/things\"))\n        .withRequestBody(equalToJson(\"{ \\\"name\\\": \\\"Widget\\\", \\\"quantity\\\": 3 }\"))\n        .willReturn(ok().withBody(\"{ \\\"id\\\": \\\"123\\\", \\\"name\\\": \\\"Widget\\\", \\\"quantity\\\": 5 }\"))\n);\n```\n\n### Verification\n\nVerify requests using JSON matchers against the decoded protobuf body:\n\n```java\nverify(\n    postRequestedFor(urlPathEqualTo(\"/api/things\"))\n        .withRequestBody(matchingJsonPath(\"$.name\", equalTo(\"Widget\")))\n);\n```\n\n### Response templating\n\nThe extension works with WireMock's response templating:\n\n```java\nstubFor(\n    post(urlPathEqualTo(\"/api/things\"))\n        .willReturn(ok()\n            .withBody(\"{ \\\"id\\\": \\\"789\\\", \\\"name\\\": \\\"{{jsonPath request.body '$.name'}}\\\" }\")\n            .withTransformers(\"response-template\"))\n);\n```\n\n## Custom descriptor path\n\nBy default the extension loads the descriptor from `/protobuf/descriptor.desc` on the classpath. To use a different path:\n\n```java\nnew ProtobufExtensionFactory(\"/custom/path/descriptor.desc\")\n```\n\n## License\n\nLicensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiremock%2Fprotobuf-extension-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiremock%2Fprotobuf-extension-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiremock%2Fprotobuf-extension-example/lists"}