Open
Conversation
Contributor
|
Hey @jdesrosiers , I noticed this PR adding the validate function and EvaluationPlugin. I'm actually studying this PR right now to use it in the lsp project (replace vscode-json-languageservice) It’s a perfect example of how to build the MatchingSchemaCollector I need using the plugin system. If you plan to merge this there, I'll probably also use the new validate function directly in the language server to power the validation diagnostics. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@hyperjump/json-schemaallows you to compile a schema once and validate many instances against that compiled schema. But, since converting from standard output to normalized output uses the compiled schema we still end up recompiling for every validation when using this package.This PR adds a
validatefunction that allows you to compile and validate returning the enhanced messaging provided by this package without needing to recompile with every validation. It does this by using an EvaluationPlugin to produce output directly in the normalized format skipping the need to convert between formats.Ideally, this function would be added to
@hyperjump/json-schemainstead of here, but it doesn't quite fit that API becausegetErrorsis async. So, I'm putting it here for now and maybe at some point we'll figure out a way to move it over where it belongs.