SwiftPackageIndex-Server icon indicating copy to clipboard operation
SwiftPackageIndex-Server copied to clipboard

No way for package authors to detect a syntax error in their `.spi.yml` file

Open daveverwer opened this issue 3 years ago • 4 comments

I had an email from the author of bytes asking why their documentation hadn't shown up and I noticed an indentation error (which was actually my fault, since the early draft of the blog post was wrong!) in the YML.

Analysis hadn't picked up the manifest and so the spi_manifest field was NULL.

We should add something to the "Information for package authors" page that says whether there's a parsing error or if any key names are incorrect and maybe also show a "What we understand from your manifest" type section where we humanise the information we have extracted.

daveverwer avatar Jun 03 '22 09:06 daveverwer

It doesn't solve or replace this, but I wondered if we could provide a JSON schema for the supported values in the spi YAML file?

There are a plethora of tools (such as this one for VS code) which provide auto complete and schema validation which would help to ensure the right format is being used.

Sherlouk avatar Jun 06 '22 08:06 Sherlouk

It doesn't solve or replace this, but I wondered if we could provide a JSON schema for the supported values in the spi YAML file?

That's interesting, but I think explaining what this file is and how to use a JSON schema for YML validation would be quite challenging. We could make a file available, but I'm not sure how comfortable I'd feel with making it prominent as I fear we would become tech support for everyone trying to install and use it with their favourite editor.

I think good documentation and error reporting on a web page are going to be the way.

daveverwer avatar Jun 06 '22 10:06 daveverwer

My idea to solve this was a little checker text box somewhere on the site where people can paste in their yml file and we run SPIManifest.load on it.

It could also host a few examples for common cases people can just copy.

finestructure avatar Jun 06 '22 10:06 finestructure

A checker page is 👍 with some examples linked to maybe in the docs.

daveverwer avatar Jun 06 '22 10:06 daveverwer