Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
phojnacki opened this issue Apr 22, 2021 · 3 comments
Labels

Comments

@phojnacki
Copy link

phojnacki commented 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

@StefH
Copy link
Collaborator

StefH commented Apr 23, 2021

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

@StefH
Copy link
Collaborator

StefH commented 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)

@phojnacki
Copy link
Author

phojnacki commented Apr 26, 2021

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

@StefH StefH closed this as completed Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants