Better error messages for schema validation #16097
Open
+395
−53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the error messages produced during project schema validation so that, where possible, we suggest valid attribute names that the user may have meant to type. For instance, if they provide a "Name" attribute where we wanted "name" (lowercase "n"), we'll now say so. Where there is not a close match, we'll enumerate the full list of
valid names to try and guide the user.
Matching is implemented using Levenshtein distances and ignores case. Some examples of the new functionality:
{"Name": ...}
yieldsproject is missing a 'name' attribute; found 'Name' instead
{..., "rutnime": ...}
yieldsproject is missing a 'runtime' attribute; found 'rutnime' instead
{..., "template": {"displayNameDisplayName": ...}, ...}
yields'displayNameDisplayName' not allowed; the allowed attributes are 'config', 'description', 'displayName', 'important', 'metadata' and 'quickstart'