apidash icon indicating copy to clipboard operation
apidash copied to clipboard

Implement fuzzy string matching to get header suggestions

Open ashitaprasad opened this issue 1 year ago • 6 comments
trafficstars

Tell us about the task you want to perform and are unable to do so because the feature is not available

Currently, header suggestions are a sequence of strings which contain the given substring with no logic implemented for ordering. Algorithms like fuzzy string search etc. can be used to provide the sequence of matching strings with the most relevant item at the top.

ashitaprasad avatar Feb 26 '24 17:02 ashitaprasad

Screenshot 2024-02-27 at 12 19 27 AM Screenshot 2024-02-27 at 12 20 01 AM

Is behavior like this is expected?

BrawlerXull avatar Feb 26 '24 18:02 BrawlerXull

Is this still being worked on?

opxdelwin avatar Mar 15 '24 05:03 opxdelwin

This issue is still open to work on @opxdelwin The issue with the closed PR was the accuracy of results. You can read the thread for more details.

animator avatar Mar 15 '24 10:03 animator

After reviewing the last PR I have added modifications to improve suggestions.

PratyushChauhan avatar Apr 01 '24 05:04 PratyushChauhan

@animator are these results good?

Before (no results due to typo): image

After (using fuzzy match): image

PratyushChauhan avatar Apr 06 '24 11:04 PratyushChauhan

@animator I worked on passing most of the test cases but there was 1 test case I could not get to pass, it is due to the nature of how fuzzy matching works. We could make an exception for this one case.:

Testing getFuzzyHeaderSuggestions function Testing using 'x-' pattern
Expected: [
              'Access-Control-Max-Age',
              'Max-Forwards',
              'X-Api-Key',
              'X-Content-Type-Options',
              'X-CSRF-Token',
              'X-Forwarded-For',
              'X-Frame-Options',
              'X-Requested-With',
              'X-XSS-Protection'
            ]
    Actual: [
              'X-XSS-Protection',
              'X-Api-Key',
              'X-CSRF-Token',
              'X-Forwarded-For',
              'X-Frame-Options',
              'X-Requested-With',
              'X-Content-Type-Options',
              'Max-Forwards',
              'Expect',
              'Expires',
              'Access-Control-Max-Age'
            ]
     Which: at location [0] is 'X-XSS-Protection' instead of 'Access-Control-Max-Age'

PratyushChauhan avatar Apr 06 '24 11:04 PratyushChauhan