Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli] Improve validation error message for vercel.json #4694

Merged
merged 14 commits into from
Jun 22, 2020

Conversation

styfle
Copy link
Member

@styfle styfle commented Jun 22, 2020

This PR improves the validation error message when the user has an invalid vercel.json file.

Previously, the error message did not account for nested properties so {"foo": "will error"} looked fine because it would mention there is an additional property foo. However, the error message for { "routes": [{ "foo": "will error" }] } did not mention anything about routes when it explaining there was an additional property foo. This became more apparent as we added nested properties for rewrites and redirects (see tests in this PR).

This PR also adds suggestions for common mistakes such as src vs source.

@vercel vercel bot temporarily deployed to Preview June 22, 2020 21:09 Inactive
@styfle styfle requested a review from MaxLeiter June 22, 2020 21:24
@kodiakhq kodiakhq bot merged commit 55cfd33 into master Jun 22, 2020
@kodiakhq kodiakhq bot deleted the ensure-good-looking-error-for-when-the-new-ch3114 branch June 22, 2020 22:38
kodiakhq bot pushed a commit that referenced this pull request Jun 24, 2020
This PR is a follow up to #4694 so we can use this same helper function in the API.

I tried to follow the existing error message format so that the API can use a different prefix than the CLI.

The API currently returns a 400 with `Invalid request` when a Git deploy fails validation:

![api-comment](https://user-images.githubusercontent.com/229881/85466548-1c140b00-b578-11ea-9bed-1eb14df2685a.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants