goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.53k stars 470 forks source link

Json schema to provide coding assistance for goss.yaml in IDEs #793

Closed gberche-orange closed 1 year ago

gberche-orange commented 1 year ago

The json schema when configured in IDEs (see updated README.md for Intellij instructions) providers coding assistance for editing and authoring goss.yaml files

including:

Checklist

Description of change

Limitations:

ripienaar commented 1 year ago

This is amazing, I've wanted to do something like this myself but always seemed too much work. Do you generate it somehow or hand built?

gberche-orange commented 1 year ago

Thanks, this is hand built but with coding assistance from intellij it goes pretty fast.

aelsabbahy commented 1 year ago

Reran Travis, if was an intermittent network issue that caused the failure.

aelsabbahy commented 1 year ago

This looks very cool. Out of curiosity, when doing templates or advanced matchers does it just fail completely or is it somewhat graceful?

gberche-orange commented 1 year ago

@aelsabbahy

This looks very cool. Out of curiosity, when doing templates or advanced matchers does it just fail completely or is it somewhat graceful?

Advanced matchers are gracefully ignored. I think it would be possible to refine the Json schema to include gomega supported matchers

For templates, unfortunately the goss documents with templates are not valid json/yaml, so the plain json can't do much yet.

image

A useful workaround would be to find a way to actually render the templates into a valid goss rendered yaml document. This way, the json validation step could be applied after a template pre-rendering step, still providing useful feedback.

I'll submit a new PR with few fixes soon, and possibly would explore those ideas.

Thanks for your quick feedback and merge (I'm just getting back from Christmas breaks)

gberche-orange commented 1 year ago

Submitted https://github.com/goss-org/goss/pull/795 with rendering preprocessing step using the render command