feat: add custom validation extension#108
Open
khalsz wants to merge 1 commit into
Open
Conversation
| import click | ||
| from pathlib import Path | ||
| from typing import Optional, List, Tuple, Any, Type | ||
| from typing import Any, List, Optional, Tuple, Type |
Contributor
There was a problem hiding this comment.
I think we can keep old code without formatting as this will be a patch? And we could better understand the real changes related to addition of custom validator.
| from ...config.config import Config | ||
| from ...query import QueryType, parse_query_arg | ||
| from . import check_meta_args, pass_config | ||
| from .validators import validate_non_negative |
Contributor
There was a problem hiding this comment.
I could not get motivation of adding custom validation. Could you please share use case where you think ITER scenarios validation is more aggressive?
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.
Summary
This PR introduces support for loading an extended custom validator class from the server configuration. This allows users to extend SimDB's validation framework while remaining compatible with upstream releases, without needing to modify SimDB directly.
With this feature, users can install their own validation package into the application's virtual environment and specify the validator class to use in the server configuration.
Example configuration:
How it works
At startup, SimDB will:
CustomValidator.CustomValidator.If no custom validator is configured, SimDB continues to use the built-in
CustomValidator, preserving the existing behaviour.Benefits
Example use case
A project can create its own package containing a validator implementation:
After installing the package into the same virtual environment as SimDB, the project only needs to configure:
No changes to the SimDB source code are required.