question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to match number with JsonPartialWildcardMatcher

See original GitHub issue

I have the following body matcher in json mapping file and I would like to match any number for price field.

    "Body": {
      "Matcher": {
        "Name": "JsonPartialWildcardMatcher",
        "Pattern": {
          "applicationId": "*",
          "currency": "EUR",
          "price": *,
          "externalId": "*",
          "transactionDescription": "*",
        },
        "IgnoreCase": false
      }
    }

The file loading crashes with File xyz.json could not be read. This file will be skipped. probably because it is not a valid json file. If I specify:

"price": "*"

no matching happens (No matching mapping found). Using AllowPartialMapping=false

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
robertmirceacommented, Aug 3, 2022

For me, I confirm that this release allows me to match numbers using regex expression. Thank you for support.

1reaction
StefHcommented, Jul 11, 2022

@robertmircea I can fix this by allowing a regular expression:

So in your case:

    "Body": {
      "Matcher": {
        "Name": "JsonPartialWildcardMatcher",
        "Regex": true, // <--- add this property
        "Pattern": {
          "applicationId": "*",
          "currency": "EUR",
          "price": "^\\d*$", // <--- use regex
          "externalId": "*",
          "transactionDescription": "*",
        },
        "IgnoreCase": false
      }
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Request Matching JsonPartialWildcardMatcher
WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating.
Read more >
Request Matching JsonPartialMatcher · WireMock-Net ...
Example for C# when you want to match the id for any number. var server = WireMockServer.Start(); server .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found