feedback
feedback copied to clipboard
Server 500 when validating YAML
Describe the bug When attempting to use the https://codecov.io/validate endpoint to valid my codecov.yaml, I received a 500 error
To Reproduce Steps to reproduce the behavior:
- Create a codecov.yml file with the code snippet below
- In the directory where the file is,
- run
curl --data-binary @codecov.yml https://codecov.io/validate - See error
Expected behavior I would expect to be told what the error is. When checking with https://yamlchecker.com/, it said the YAML was valid. Since the error lies in the schema, and not the YAML parser, I would expect something more helpful then a server failure. I have a large codecov.yml file, and I got lucky at guessing the error.
I also have the Codecov VSCode extension installed, and it reported no error. VSCode is correctly identifying the file type as Codecov
It would be nice if the Codecov UI could also surface the error. The commit here https://app.codecov.io/gh/drazisil/mcos/commit/1bd4e2389eb1a718dcb695c97fd352f6389e1be4 shows an error, but gived no clue as to what and points me to the validation note in the doc.
Additional context
The error lies in the type key under component_management: individual_components: component_id: statuses: not being prefixed with a dash.
Test Case
component_management:
default_rules: # default rules that will be inherited by all components
statuses:
- type: project # in this case every component that doens't have a status defined will have a project type one
target: auto
branches:
- "!main"
individual_components:
- component_id: module_nps
name: Team 2
statuses:
type: patch # <-- This is the offending line
target: auto
paths:
- lib/nps/**
since this is an old issue, @drazisil-codecov will re-evaluate to see if issue persists.
Still occurs
Looked into this / reproduced and it appears it is thrown within our helper library for basic yaml parsing (cerberus) which expected an array in the schema ("prefixed with a dash") but got a flat object. Will need to figure out how best to fix to better communciate to user the error instead of the current catch-all 500
https://github.com/codecov/shared/pull/588/files