Import from OpenApi generates model with path parameter narrowed in range (example value=42 instead of '*') #347

Closed
opened 2025-12-29 15:21:27 +01:00 by adam · 3 comments
Owner

Originally created by @phojnacki on GitHub (Apr 22, 2021).

I cannot generate pattern with wildcard like:

 {
        "Guid": "43ae7a55-3aa7-4600-988b-f81a92d17b0f",
        "Request": {
            "Path": {
                "Matchers": [
                    {
                        "Name": "WildcardMatcher",
                        "Pattern": "/api/Targets/Allowed/*",  <============ "/*"
                        "IgnoreCase": false
                    }
                ]
            },
            "Methods": [
                "DELETE"
            ]
        },

I can only generate one with

               "Matchers": [
                    {
                        "Name": "WildcardMatcher",
                        "Pattern": "/api/Targets/Allowed/42",  <============ "/42"
                        "IgnoreCase": false
                    }

It's too narrow since I cannot emulate fully mocked API (only request with 42 is working and the rest of requests answer with "No matching mapping found")

I'd like it to be possible to generate patterns with wildcards having following OpenApi definition:

"/api/Targets/Allowed/{targetId}": {
      "get": {
        "tags": [
          "Allowed"
        ],
        "parameters": [
          {
            "name": "targetId",
            "in": "path", <==============
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],

We may think of an optional import parameter UseExampleValuesInPaths=false or similar.

image
image

Originally created by @phojnacki on GitHub (Apr 22, 2021). I cannot generate pattern with wildcard like: ``` json { "Guid": "43ae7a55-3aa7-4600-988b-f81a92d17b0f", "Request": { "Path": { "Matchers": [ { "Name": "WildcardMatcher", "Pattern": "/api/Targets/Allowed/*", <============ "/*" "IgnoreCase": false } ] }, "Methods": [ "DELETE" ] }, ``` I can only generate one with ``` json "Matchers": [ { "Name": "WildcardMatcher", "Pattern": "/api/Targets/Allowed/42", <============ "/42" "IgnoreCase": false } ``` It's too narrow since I cannot emulate fully mocked API (only request with 42 is working and the rest of requests answer with "No matching mapping found") I'd like it to be possible to generate patterns with wildcards having following OpenApi definition: ``` json "/api/Targets/Allowed/{targetId}": { "get": { "tags": [ "Allowed" ], "parameters": [ { "name": "targetId", "in": "path", <============== "required": true, "schema": { "type": "integer", "format": "int32" } } ], ``` We may think of an optional import parameter UseExampleValuesInPaths=false or similar. ![image](https://user-images.githubusercontent.com/11637307/115690219-1edcb980-a35d-11eb-9230-3ebe91b49ed5.png) ![image](https://user-images.githubusercontent.com/11637307/115690571-7549f800-a35d-11eb-8f1b-cdfed6f1844a.png)
adam added the feature label 2025-12-29 15:21:27 +01:00
adam closed this issue 2025-12-29 15:21:28 +01:00
Author
Owner

@StefH commented on GitHub (Apr 23, 2021):

@phojnacki Can you please provide a full working openapi document which has this issue?

@StefH commented on GitHub (Apr 23, 2021): @phojnacki Can you please provide a full working openapi document which has this issue?
Author
Owner

@StefH commented on GitHub (Apr 24, 2021):

@phojnacki / @kusza6
Can you try preview version : 1.4.12-ci-14936 (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)

@StefH commented on GitHub (Apr 24, 2021): @phojnacki / @kusza6 Can you try preview version : 1.4.12-ci-14936 (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)
Author
Owner

@phojnacki commented on GitHub (Apr 26, 2021):

@StefH Yey, it works like a charm. Thanks a lot for adding this feature.

@phojnacki commented on GitHub (Apr 26, 2021): @StefH Yey, it works like a charm. Thanks a lot for adding this feature.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#347