miyagi icon indicating copy to clipboard operation
miyagi copied to clipboard

Provide more information on violation of `additionalProperties: false`

Open riidom opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. The problem is, in big clunky schema/mocks.yaml's, it is sometimes a bit hard to find the mistyped or misplaced property.

Describe the solution you'd like In console, instead of:

2023/07/07 15:22 Error: template-components/header — default:
data must NOT have additional properties

I'd like an additional piece of text with the name/key of the invalid mock data, and maybe the parent properties, to see where it sits (often there are a lot of properties with same name, like url). Similarly for the error message in the web frontend which just says Invalid mock data.

Describe alternatives you've considered None, I figured if there is a comparison check between allowed keys (schema) and provided keys (mocks), the ones causing the differences should be on display somehow.

Additional context

riidom avatar Aug 07 '23 13:08 riidom

This information is coming from a plugin which does not provide more information afaik. I will double check though :)

mgrsskls avatar Sep 01 '23 08:09 mgrsskls

The reason AJV does not give more information is stated here: https://ajv.js.org/faq.html#why-don-t-additionalproperties-false-errors-display-the-property-name So, nothing to do from our side unfortunately :/ I will close this issue, but please let me know if there are other issues where you are missing more information!

mgrsskls avatar Jul 20 '24 20:07 mgrsskls