add relaxation flag to validator call #103
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This arises in the context of determining what sorts of intermediate representations we want for notebooks in nbconvert: jupyter/nbconvert#643
It was suggested by @minrk that we only allow additional fields (and no additional values for existing fields or the deletion of fields) in terms of this intermediate representation.
Up until now, we thought that preprocessors had always only created valid notebooks. That turns out to be not be the case (jupyter/nbconvert#645).
It would be nice to be able to establish that the only things allowed by preprocessors is to exactly what we say it is.
To that end, this adds a flag to the
validate
API (and theget_validator
API) for communicating that that specific relaxation is to be adhered to and otherwise the notebook is entirely valid.This allows the use of
nbformat.validate(…, relax_add_props=True)
in the nbconvert preprocessor checks which will ensure that 3rd party preprocessors similarly adhere to this restriction on the nbconvert internal representation.