hubverse-org / hubUtils

Utility functions for Infectious Disease Modeling Hubs
https://hubverse-org.github.io/hubUtils/
Other
6 stars 3 forks source link

Unexpected successful validation of malformed tasks.json file #76

Closed elray1 closed 1 year ago

elray1 commented 1 year ago

The tasks.json file in the example-simple-forecast-hub currently has a target_metadata block that is in the wrong location, here. That block is nested within the "output_type" block, but I think it should not be there. Note that the output_type specification in the schema file does not include target_metadata as a valid output type.

However, running hubUtils::validate_config yields a passing result:

> library(hubUtils)
> hubUtils::validate_config(".")
Loading required namespace: jsonvalidate
✔ Successfully validated config file ./hub-config/tasks.json against schema <https://raw.githubusercontent.com/Infectious-Disease-Modeling-Hubs/schemas/main/v1.0.0/tasks-schema.json>
[1] TRUE
attr(,"config_path")
./hub-config/tasks.json
attr(,"schema_version")
[1] "v1.0.0"
attr(,"schema_url")
https://raw.githubusercontent.com/Infectious-Disease-Modeling-Hubs/schemas/main/v1.0.0/tasks-schema.json
annakrystalli commented 1 year ago

😳 Very strange! That should indeed be failing. Will investigate!

annakrystalli commented 1 year ago

Turns out additional properties are just ignored by default and additionalProperties; false is required to explicitly throw an error https://json-schema.org/understanding-json-schema/reference/object.html#additional-properties

Fixed in the schema via https://github.com/Infectious-Disease-Modeling-Hubs/schemas/pull/51