posit-dev / publisher

MIT License
3 stars 0 forks source link

TOML Validation: Using wrong type in config toml throws confusing errors #637

Closed kgartland-rstudio closed 1 day ago

kgartland-rstudio commented 9 months ago

I mistakenly didn't quote my title in the configuration toml and got a confusing error. Can we catch these errors and throw something less confusing?

> publisher create .
time=2023-12-18T09:18:41.782-05:00 level=ERROR msg="Error running command" error="can't load file '.posit/publish/default.toml': 2| type = 'python-fastapi'\n3| entrypoint = 'simple.py'\n4| validate = true\n5| title = fastapi\n |         ~~~~~ expected 'false'\n6|\n7| [python]\n8| version = '3.11.6'"

can't load file '.posit/publish/default.toml': 2| type = 'python-fastapi'
3| entrypoint = 'simple.py'
4| validate = true
'$schema' = 'https://cdn.posit.co/publisher/schemas/posit-publishing-schema-v3.json'
5| title = fastapi
 |         ~~~~~ expected 'false'
6|
7| [python]
8| version = '3.11.6'.

Lilkewise setting validate to a string

> publisher create .
time=2023-12-18T09:20:46.355-05:00 level=ERROR msg="Error running command" error="can't load file '.posit/publish/default.toml': 1| '$schema' = 'https://cdn.posit.co/publisher/schemas/posit-publishing-schema-v3.json'\n2| type = 'python-fastapi'\n3| entrypoint = 'simple.py'\n4| validate = asdfadsf\ntitle = 'fastapi'\n\n[python]\nversion = '3.11.6'\npackage-file = 'requirements.txt'\npackage-manager = 'pip'\n\n |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ incomplete number"

can't load file '.posit/publish/default.toml': 1| '$schema' = 'https://cdn.posit.co/publisher/schemas/posit-publishing-schema-v3.json'
2| type = 'python-fastapi'
3| entrypoint = 'simple.py'
4| validate = asdfadsf
title = 'fastapi'

[python]
version = '3.11.6'
package-file = 'requirements.txt'
package-manager = 'pip'

 |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ incomplete number.
dotNomad commented 1 day ago

Closing, can re-open as a new issue if we find something similar.