-
Notifications
You must be signed in to change notification settings - Fork 155
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
Addition of renv.lock
schema
#1877
Comments
Thanks! I think this makes sense. We'd probably want to include this in the My main questions would be around how we should handle future potential changes to the lockfile format. I imagine we'll have to do something like:
Does that make sense? |
To my knowledge, generally in situations like this practitioners avoid creating a version of a schema for each new version of what they’re validating and instead just expand the schema. JSON schema has the flexibility to set fields such as JSON schema also has a Here's my current thoughts: we define a schema that validates all the fields For those who want more stringent validation, the function we write to validate can have a “bring your own schema” parameter, so to speak. Users can validate against lockfile_validate <- function(
lockfile = NULL, # Use default project lockfile if not provided
lockfile_schema = NULL, # Use default schema in inst if not provided
# Other parameters
) This would make sense for those who have very specific production requirements for their validation. Let me know what you think. I'll put in a PR with what I'm thinking this week so it can be discussed and iterated over. It will include a schema, an exported validation function, and tests. |
Thanks! This all sounds reasonable to me; I'd be happy to review a PR. |
Merged in #1889. |
I see there's been some talk about having a
renv.lock
schema (#1107). I put together a minimal version of this schema and opened a PR over at lorenzwalthert/precommit#558 that would usepre-commit
to validaterenv.lock
files against the schema.If there's still interest, it may be a better idea to fill out the schema more and put in a PR here instead, just let me know where it should live. Then it could be maintained here, perhaps with a new
renv::validate_lockfile()
function, and we could add a hook at https://github.com/lorenzwalthert/precommit that utilizes the functionality native to {renv
}Or I could throw the schema over at https://github.com/SchemaStore/schemastore instead. In any case, I'm happy to do the work and put in a PR with the schema and anything else. Let me know.
The text was updated successfully, but these errors were encountered: