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

Add schemas #124

Open
alvaromartmart opened this issue Mar 8, 2024 · 0 comments
Open

Add schemas #124

alvaromartmart opened this issue Mar 8, 2024 · 0 comments

Comments

@alvaromartmart
Copy link
Member

alvaromartmart commented Mar 8, 2024

It is possible to use JSON schemas to validate the YML files, which would make it much easier to author these.

I don't have too much experience with YML validation tooling, but I have managed to set up some basic integration in VSCode, involving:

  • Creating a seqera-kit.schema.json declaring the valid properties for organizations, e.g.
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "seqerakit yml file",
    "type": "object",
    "properties": {
        "organizations": {
            "description": "Organizations",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "description": "Name of the organization"
                    },
                    "full-name": {
                        "type": "string",
                        "description": "Full name"
                    },
                    "description": {
                        "type": "string",
                        "description": "Description of the organization"
                    },
                    "location": {
                        "type": "string",
                        "description": "Description of the organization"
                    },
                    "website": {
                        "type": "string",
                        "description": "Website"
                    },
                    "overwrite": {
                        "type": ["boolean", "string"],
                        "description": "Overwrite the organization if it already exists"
                    }
                },
                "required": ["name"]
            }
        }
    }
}
  • Telling VSCode which local json.schema file to use to validate specific .yml files:
	"settings": {
		"yaml.schemas": {
			"file:///seqera-kit.schema.json": "seqera-kit/**.yml"
		},
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

No branches or pull requests

1 participant