DMTF / Redfish-Service-Validator

The Redfish Service Validator is a Python3 tool for checking conformance of any "device" with a Redfish service interface against Redfish CSDL schema
Other
39 stars 33 forks source link

Add fuzzy string matching for identifying misspelled properties. #593

Open jautor opened 1 month ago

jautor commented 1 month ago

I've seen numerous instances in product testing where a property name was misspelled. Usually this is a capitalization error or a one-letter transposition. If the tool can be enhanced to attempt a fuzzy string match (check thefuzz python module and the process.extractOne function) when it finds an unknown property - it could replace the misspelled property (flagged as wrong of course) with the best match and attempt further validation.

That would allow any value errors to also be reported, instead of requiring the property names to be corrected prior to validating the value. This would be especially useful when navigation properties are misspelled, as that prevents the tool from traversing the tree (and therefore skips testing on entire resources).

tomasg2012 commented 1 month ago

I believe this is still a feature in the service validator with the function "get_fuzzy_property" but maybe it's not getting certain examples. It will adjust RedfishVersion from ReedfishVersion and redfishversion and report an error if it was incorrect (example, an int and not a string). It will always report it as "invalidNamedProperty"

jautor commented 1 month ago

Oh, good, I guess I haven't seen it "in action"... It doesn't seem to be working on @odata.id misspellings within navigation links. I'm guessing it's not being applied to annotations?

As in:

   "Chassis": {
         "@odata.Id": "/redfish/v1/Chassis"
   }

(the odata.id has a capital "I" in this example)

tomasg2012 commented 1 month ago

It isn't used in every place a property is looked for, usually odata is handled separately. Can preprocess a payload to catch missing odata early on.