Skip to content

Add a JSON schema for the maintainers JSON file #18

@agriyakhetarpal

Description

@agriyakhetarpal

This would help with some basic validation; i.e., have a list of allowed labels for socials.labels (with "additionalProperties": false), link/project_link/website_link should match a URI, projects can be an array, and the rest can be strings, or anything else as applicable.

https://github.com/python-jsonschema/check-jsonschema can then be used to validate it, with something like

import json
import jsonschema

with open("maintainer.schema.json") as f:
    schema = json.load(f)

with open("maintainer.json") as f:
    data = json.load(f)

try:
    jsonschema.validate(instance=data, schema=schema)
except jsonschema.exceptions.ValidationError as e:
    # do whatever with the error

or with their built-in pre-commit hooks – perhaps those might fit better after #17 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions