DX: Helpful output when serverless.yml is malformed
See original GitHub issueThis is a Feature Proposal
Description
If a user attempts to put a user-defined top-level property in serverless.yml (other than one called custom
), it is silently ignored while packaging and anything referencing that property will fail down the line, potentially not until deployment time.
I think this issue is compounded by the fact that the documentation isn’t entirely clear on the fact that a custom top-level property in the yml file must be called custom
.
-
What went wrong?
serverless package
does not call out that an improperly named top-level property is defined and will be ignored. Instead, there is only a warning that properties referencing this top-level property have no value. -
What did you expect should have happened?
- If
custom
is the only name allowed for user-defined top level properties, I would expect a warning or error at theserverless package
step to alert the user that what they’re trying to do isn’t going to work. - I’d also expect that the documentation would have a sentence explicitly calling out that this naming restriction exists.
- If
-
What was the config you used?
Example serverless.yml exerpt:
service: foo
# This will work
custom: someValue
# This will not
bar: someValue
provider:
...
Feature proposals:
serverless package
prints a warning or error when it detects a top-level property which it’s going to ignore.- Documentation is improved to be more explicit about the
custom
naming convention.- If this is desired, I can look at putting in a PR.
Additional Data
- Serverless Framework Version you’re using: 1.18
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (14 by maintainers)
I asked a potentially related question on the forum a while back https://forum.serverless.com/t/formal-specification-of-serverless-yml/6285
Having a json schema representation would enable a feature this gh is asking for as well as tooling for vscode I’m working on
I think that’s a great idea too. I misunderstood that
custom
section is for only framework users.