Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Dec 25, 2022

Conversation

gberche-orange
Copy link
Contributor

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:

  • completion
    image
  • inline doc in text or html format for long examples
    image
  • inspection such as required properties
    image
Checklist
  • make test-all (UNIX) passes. CI will also test this
  • unit and/or integration tests are included (if applicable)
  • documentation is changed or added (if applicable)

Description of change

  • adds a json schema file in yaml format
  • addsa a sample goss.yaml file gathering most currently documented examples. Used for testing the json schema

Limitations:

  • coverage for matchers is still low.
  • advanced matchers are not yet modeled
  • templates likely can't be supported by json schema, and the source document isn't valid yaml

@ripienaar
Copy link
Collaborator

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
Copy link
Contributor Author

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

@aelsabbahy
Copy link
Member

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

@aelsabbahy
Copy link
Member

aelsabbahy commented Dec 24, 2022

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

@ripienaar ripienaar self-requested a review December 25, 2022 09:11
Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@aelsabbahy aelsabbahy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking the time to contribute this.

@aelsabbahy aelsabbahy merged commit a157ea3 into goss-org:master Dec 25, 2022
@gberche-orange
Copy link
Contributor Author

@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
Copy link
Contributor Author

Submitted #795 with rendering preprocessing step using the render command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants