legacy-cli icon indicating copy to clipboard operation
legacy-cli copied to clipboard

Unknown section checks in app config file

Open mcyprian opened this issue 7 years ago • 2 comments

I have a simple config file like this:

name: app 
type: "python:3.7"

dependecies:
    python:
       pipenv: '*' 

hooks:
    build: |
      pipenv install --system

disk: 1024

web:
    commands:
        start: python server.py

CLI currently checks if the required fields (name, type and disk) are present. In case there is some extra non existing section like dependecies with missing n letter it is not detected and the build simply fails during the build hook. Similar typos and mistakes are easy to make, but hard to debug. Could be some additional logic added to prevent issues like this one?

mcyprian avatar Sep 20 '18 10:09 mcyprian

This should be improved somewhere, but I'm not sure how. The problem is currently that Platform.sh's (git) server-side validation of the .platform.app.yaml file deliberately does allow any root keys in that file. I think it's partly for forwards and backwards compatibility, and partly (I imagine?) so that custom YAML syntax can be supported.

The CLI shouldn't include much more complicated schema/validation logic than the server (maintenance and support of older versions would get out of control), but maybe there's a way to subtly warn about typos like this.

pjcdawkins avatar Sep 21 '18 10:09 pjcdawkins

The strict validation is maybe not necessary. I can imagine something like a warning 'dependecies' is not a known entry, did you mean 'dependencies'? in case the entry that is really similar to the existing one is detected. User can ignore it in case he knows what is he doing and it will still serve its purpose.

mcyprian avatar Sep 21 '18 14:09 mcyprian