hubverse-org / schemas

JSON schemas for modeling hubs
Creative Commons Zero v1.0 Universal
4 stars 2 forks source link

versioning for schemas, suggest that instances of the schema reference the versioned schema #2

Closed elray1 closed 1 year ago

elray1 commented 1 year ago

I think we would like the schemas that are defined in this repository to be versioned -- that way, a configuration file like admin.json in a hub repository can reference the version of the admin-schema.json file that it is based on, and if we ever make changes to the schema definition, downstream tools can still process the hub's admin config settings correctly.

I'm not sure if there is a standard way to do this, but maybe we can use naming conventions like admin-schema-v0.0.1?

Then, we might expect the file like admin.json in a hub to look like this:

{
    "$schema": "https://raw.githubusercontent.com/Infectious-Disease-Modeling-Hubs/schemas/main/admin-schema-v0.0.1.json",
    "name": "Simple Forecast Hub",
    "maintainer": "Consortium of Infectious Disease Modeling Hubs",
    "contact": {
        "name": "Joe Bloggs",
        "email": "j.bloggs@cidmh.com"
    },
    "repository_url": "https://github.com/Infectious-Disease-Modeling-Hubs/example-simple-forecast-hub",
    "hub_models": [{
        "team_abbr": "simple_hub",
        "model_abbr": "baseline",
        "model_type": "baseline"
    }]
}

And in turn, admin-schema-v0.0.1.json would need to specify that such a $schema property is expected:

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "title": "Hub administrative settings",
    "description": "This JSON file provides a schema for modeling hub administrative information.",
    "type": "object",
    "properties": {
        "$schema": {
            "description": "The version of the schema file used to define the administrative settings config file",
            "type": "string",
            "example": "https://raw.githubusercontent.com/Infectious-Disease-Modeling-Hubs/schemas/main/admin-schema-v0.0.1.json"
        },
        "name": {
            "description": "The name of the hub.",
            "type": "string",
            "example": "US COVID-19 Forecast Hub​"
        },
    ...
}
nickreich commented 1 year ago

@elray1 suggests that we enforce that URLS point to versions, and not point to a file that could be updated without the filename changing.

elray1 commented 1 year ago

Pasting here some links that Harry had found previously:

annakrystalli commented 1 year ago

Agree with the general approach that can be summarised from the discussion and above links. This is what I'm proposing to do:

Considerations: