Giter Club home page Giter Club logo

Comments (3)

annakrystalli avatar annakrystalli commented on July 30, 2024

Hey @LucieContamin

Thanks for the bug report!

The first error is because we are using the Suggests to list packages that hub maintainers might need but users that just want to load data don't. This is because the V8 package that jsonvalidate depends on can be annoying to install on Linux but is only required for the schema validation so we didn't want to require it for all users.

There's a note about it at the top of the vignette https://infectious-disease-modeling-hubs.github.io/hubUtils/articles/hub-setup.html but I knew that wasn't enough so I've added a check for it in the function. Now if the jsonvalidate isn't installed when you call validate_config() you get a more informative message with instructions.

I've pushed this change as well as the dynamic validation functionality to branch r-config-val (still need to write more tests before it can be reviewed and merged).

You can install it with:

remotes::install_github("Infectious-Disease-Modeling-Hubs/hubUtils", ref = "r-config-val", dependencies = TRUE)

Use v0.0.1 schema

The latest schema version was (unreleased) on the v0.0.1 branch in the schemas repo but I've just gone ahead and released it on the main branch for you.

Now if I run (in the megaround project):

library(hubUtils)
validate_config(config = "tasks")

I get:

Error in `get_config_schema_version()`:
! Valid version could not be extracted from config file
  ./hub-config/tasks.json
! Please check property "schema_version" is correct.

because there is no schema_version property. This is necessary for validation to be performed correctly. (see https://github.com/Infectious-Disease-Modeling-Hubs/schemas/blob/c71c4e655dbf2cd293176d5cf421a3782aa13c66/v0.0.1/tasks-schema.json#L8-L12)

When I add:

"schema_version": "https://github.com/Infectious-Disease-Modeling-Hubs/schemas/blob/main/v0.0.1/tasks-schema.json",

above the rounds property in your tasks.json, I now get a single error relating to the fact you are using output_types rather than output_type.

Once I fix that, validation succeeds!!

Note that I've removed the automatic launching of a more user friendly error report. That now is in a separate function called view_config_val_errors(). However the bug is somewhere in that function (which was triggered automatically in the previous version of hubUtils) so I will use your tasks.json to figure out why it's causing view_config_val_errors() to fail.

You can still access the errors table generated by jsonvalidate package with:

out <- validate_config(config = "tasks")
attr(out, "errors")

from hubutils.

LucieContamin avatar LucieContamin commented on July 30, 2024

Hey @annakrystalli ,

Thank you very much for the detailed information. It makes more sense now.

For the install, I did not consult the vignette when I install the package I just look at the README, so might be interesting to add that information on the README too.

I will update the schema version and fix my output-type errors!

Thank you very much again

from hubutils.

annakrystalli avatar annakrystalli commented on July 30, 2024

Yes you're totally right about the README. It definitely needs to be mentioned there.

from hubutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.