nidi3 / raml-tester

Test if a request/response matches a given raml definition
Apache License 2.0
71 stars 14 forks source link

MediaType similarity score discounts exact type and sub-type match #62

Closed snmvaughan closed 8 years ago

snmvaughan commented 8 years ago

In the function similarity(MediaType), an exact match on type and sub-type will only score a 4 or a 3, while the known suffixes matches will always score a 4. This means that a known suffix will either collide with an exact match, or be scored higher than an exact match.

Example: Given a response body of either "application/ld+json" or "application/vnd.geo+json", and a target type of "application/ld+json;charset=ISO-8859-1":

I'd suggest that matching by a known suffix should at best be scored lower than an exact match on type and sub-type.

nidi3 commented 8 years ago

Sorry for the late response. You are right. I'm going to have a look at it.