Tom
01/06/2023, 6:33 PMJai Nigam
03/24/2023, 1:19 AMJai Nigam
03/24/2023, 1:20 AMOleg Nenashev
04/04/2023, 8:51 AMOleg Nenashev
04/07/2023, 12:41 PMmanpreet
07/12/2023, 11:00 PMUri
07/12/2023, 11:03 PMUri
07/12/2023, 11:05 PMmanpreet
07/12/2023, 11:08 PMUri
07/12/2023, 11:08 PMmanpreet
07/12/2023, 11:10 PMUri
07/12/2023, 11:13 PMRully Afrizal Alwin
08/18/2023, 5:47 AMBrian Bezanson
08/29/2023, 9:17 PMPOST /documents
that is used to upload a document.
In the Swagger we have multiple responses defined: 200, 400, 401, 403, 422, 500, 502, 503, 504.
I went ahead and processed that Swagger and downloaded the WireMock mapping file.
In looking at the mapping file I see that it creates mappings for all of our response definitions for each endpoint.
In that mapping file for uploading a document (POST /documents
) I see a group at the top of the file for:
• 200
• 401
• 403
As the WireMock documentation shows, the default priority if none is specified is “5”.
Further down the file (in this order) I see the mappings for the following:
• 400 - priority 8
• 422 - priority 9
• 500 - priority 10
• 502 - priority 10
• 503 - priority 10
• 504 - priority 10
Auto-Generation Issue
So my issue with the auto-generated file is that when I call this created mapping file I would expect to get the 200 response.
But the WireMock rules for matching are:
• Highest Priority (lowest #)
• If the same priorities, the last physical definition read in the file
So in this case I receive a 403 as the response.
To get the 200 response I want, I need to define a priority higher than 5 (1-4) for that mapping.
So my questions for the WireMock team would be:
• Is there any reason to generate mappings for the 4xx or 5xx responses? Normally these would only come back because of a business logic rule failure or server failure.
◦ I could see a general 404 as a low-priority global match for GETs
• If there is a reason to generate all of the response codes, then maybe have settings where I can
◦ Have the 2xx entries set to a priority I specify (like 1)
◦ Explain the reasoning for the priorities shown above (some 4xx are default, 400 is a 8, and 422 a 9).
◦ Is there a way I could add a header or path parameter specifically for WireMock to trigger a specific response mapping?
▪︎ Like header/path parameter of “wiremock-response-code” set to some value like 400, 422, 501, etc.
• Another separate option for generation would be to ignore any “server” definitions in the OAS file. That server context-path was added to my defined context-path.
Thanks for any/all help - BrianBrian Bezanson
09/26/2023, 5:03 PMYoni Goldberg
09/28/2023, 7:30 AMYoni Goldberg
09/29/2023, 6:57 AMPeter Wilson
10/04/2023, 10:21 PMTom
10/05/2023, 3:42 PMSimon Verhoeven
10/12/2023, 5:48 PMDamodar Bhatt
10/18/2023, 10:39 AMDamodar Bhatt
10/18/2023, 10:40 AMLi Ma
10/19/2023, 8:12 AMlei lu
10/29/2023, 10:58 AMboris dimitrijevic
11/01/2023, 11:46 PMboris dimitrijevic
11/01/2023, 11:47 PMboris dimitrijevic
11/02/2023, 5:49 PMboris dimitrijevic
11/02/2023, 5:49 PMboris dimitrijevic
11/02/2023, 7:30 PMboris dimitrijevic
11/02/2023, 7:30 PM<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<version>3.2.0</version>
</dependency>