<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mockzilla</title>
    <description>The latest articles on DEV Community by Mockzilla (@mockzilla).</description>
    <link>https://dev.to/mockzilla</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3961128%2F90f295bd-c6e5-417d-b1f6-3e0a04ee2769.png</url>
      <title>DEV Community: Mockzilla</title>
      <link>https://dev.to/mockzilla</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mockzilla"/>
    <language>en</language>
    <item>
      <title>WireMock will not read your OpenAPI spec, and that is on purpose</title>
      <dc:creator>Mockzilla</dc:creator>
      <pubDate>Fri, 04 Sep 2026 14:04:14 +0000</pubDate>
      <link>https://dev.to/mockzilla/wiremock-will-not-read-your-openapi-spec-and-that-is-on-purpose-a5j</link>
      <guid>https://dev.to/mockzilla/wiremock-will-not-read-your-openapi-spec-and-that-is-on-purpose-a5j</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I work on Mockzilla, which competes with WireMock. Everything below&lt;br&gt;
was run on my laptop today and every claim links to its source. There is a link&lt;br&gt;
to the longer comparison at the end, and you can stop reading before it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You have an OpenAPI document. You want a mock server. WireMock is what most&lt;br&gt;
people find first, so you start the container and give it your spec.&lt;/p&gt;

&lt;p&gt;It will not read it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Two ways it fails
&lt;/h2&gt;

&lt;p&gt;Drop the spec where WireMock keeps its stubs and start it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 8080:8080 &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;/wiremock:/home/wiremock"&lt;/span&gt; wiremock/wiremock:3.13.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The container comes up. It also loaded nothing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; localhost:8080/__admin/mappings | jq .meta
&lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"total"&lt;/span&gt;: 0 &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;WireMock reads &lt;code&gt;.json&lt;/code&gt; from that directory and ignores everything else, so a&lt;br&gt;
&lt;code&gt;.yml&lt;/code&gt; spec sits there in silence. Convert it to JSON, which is the obvious next&lt;br&gt;
move, and the container stops starting at all:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MappingFileException: Error loading file /home/wiremock/./mappings/openapi.json:
Unrecognized field "openapi" (class ...StubMappingCollection), not marked as ignorable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;openapi&lt;/code&gt; is an unrecognized field.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why
&lt;/h2&gt;

&lt;p&gt;This is not an oversight. OpenAPI import is a WireMock Cloud feature and the&lt;br&gt;
open source version has never had it. Somebody &lt;a href="https://github.com/wiremock/wiremock/issues/976" rel="noopener noreferrer"&gt;asked for it in August 2018&lt;/a&gt;, and &lt;a href="https://github.com/wiremock/wiremock/issues/976#issuecomment-412055701" rel="noopener noreferrer"&gt;the answer&lt;/a&gt; came the next morning from WireMock's creator:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I don't have any plans to open source MockLab's implementation at the moment.&lt;br&gt;
I'd suggest if you want to work on this that you make it an extension.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;MockLab was the earlier name of WireMock Cloud. Eight years on, the feature is&lt;br&gt;
still on that side of the line.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you write instead
&lt;/h2&gt;

&lt;p&gt;One JSON file per stub, each holding a &lt;code&gt;request&lt;/code&gt; matcher and a &lt;code&gt;response&lt;/code&gt;. A&lt;br&gt;
minimal one for a single endpoint runs about 25 lines, and it covers exactly&lt;br&gt;
that endpoint. Ask for the next path along and you get &lt;code&gt;Request was not matched&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Twilio Verify is a small API: 29 paths, 53 operations. That is 53 stub files,&lt;br&gt;
and every field in them is a response shape you looked up by hand and typed.&lt;br&gt;
GitHub's public API description is 551 paths and 845 operations.&lt;/p&gt;

&lt;p&gt;Then there is the part that shows up later. Your spec and your stubs are now two&lt;br&gt;
descriptions of the same API, maintained at different times, and only one of&lt;br&gt;
them is what the service implements. Somebody has published a GitHub Action&lt;br&gt;
called &lt;a href="https://github.com/tidusjar/Wiremock.OpenAPIValidator" rel="noopener noreferrer"&gt;WireMock OpenAPI Validator&lt;/a&gt;&lt;br&gt;
whose entire job is checking stub mappings against a spec in CI, and it&lt;br&gt;
describes itself as "perfect for ensuring your mocks stay in sync with your API&lt;br&gt;
contracts".&lt;/p&gt;

&lt;h2&gt;
  
  
  This is not a bug report
&lt;/h2&gt;

&lt;p&gt;WireMock's unit of work is a stub: one matcher, one canned response. A spec is&lt;br&gt;
not a stub, so the tool is consistent with what it is. The project is also in&lt;br&gt;
good health, with 3.13.2 shipped in November 2025 and v4 in beta.&lt;/p&gt;

&lt;p&gt;Three things it does that a spec-driven mock does not. WireMock runs inside your&lt;br&gt;
test process, in Java and through wrappers in .NET, Python, Go and Rust. You can&lt;br&gt;
assert on the requests your code sent, so &lt;code&gt;verify(getRequestedFor(...))&lt;/code&gt; fails&lt;br&gt;
the test when the call never happened. And its scenarios move a stub between&lt;br&gt;
states, so the same call answers differently the second time.&lt;/p&gt;

&lt;p&gt;If you need any of those, none of this matters and WireMock is your answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you do have a spec
&lt;/h2&gt;

&lt;p&gt;The alternative is a server that takes the document as its input, so the mock&lt;br&gt;
and the contract are one file. I wrote up the full comparison with both tools&lt;br&gt;
running the same API side by side, including the measurements, the per-endpoint&lt;br&gt;
cost, and where WireMock still wins:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mockzilla.org/en/articles/wiremock-alternative-openapi" rel="noopener noreferrer"&gt;WireMock alternative: mock an OpenAPI spec without writing stubs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>openapi</category>
      <category>java</category>
      <category>testing</category>
      <category>api</category>
    </item>
  </channel>
</rss>
