-
Notifications
You must be signed in to change notification settings - Fork 27
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
Implement flexible format validators #426
Implement flexible format validators #426
Conversation
a1ead19
to
9660e82
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the declarative syntax. From my POV, go ahead with the rest of the implementation for the remaining types.
Minor nitpick for the docs: I'd add a comment noting that it's OK to overwrite the validate() method for more complex validations, and what you can do with it. (Along with the note to have a corresponding implementation in the frontend as well, of course)
The API looks great to me as well! 👍 |
9660e82
to
533d02a
Compare
This commit adds flexible format validators. There is one new query: `all_format_validators` that enables querying all available format validators. A text- or textarea-question can have one or multiple format_validators assigned. When querying a question, there is a new `FormatValidatorsConnection`, containing all FormatValidator-objects assigned on the question. For this there is a new `QuestionValidator` that ensures, referenced format_validators exist. `translate_value()` has been moved to `core.utils`, as this is used in the `data_source`- and `form`-app. There is a new extension-point `format_validators.py`. When adding the tests for this, it became obvious, that there was something wrong with the parameters for `DataSource`. As I was touching those tests anyway, I fixed this as well. Added commented out extension volume to docker-compose.yml. Also added forgotten data_sources extension volume. Additionally this commit also cleans up the snapshots for document and question as there were quite a lot old unused snapshots. Closes projectcaluma#360
533d02a
to
8011518
Compare
I've added the info about overriding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, looks good!
This commit adds flexible format validators.
There is one new query:
all_format_validators
that enables queryingall available format validators.
A text- or textarea-question can have one or multiple format_validators
assigned.
When querying a question, there is a new
FormatValidatorsConnection
,containing all FormatValidator-objects assigned on the question.
For this there is a new
QuestionValidator
that ensures, referencedformat_validators exist.
translate_value()
has been moved tocore.utils
, as this is used in thedata_source
- andform
-app.There is a new extension-point
format_validators.py
.When adding the tests for this, it became obvious, that there was something
wrong with the parameters for
DataSource
. As I was touching those testsanyway, I fixed this as well.
Added commented out extension volume to docker-compose.yml. Also added
forgotten data_sources extension volume.
Additionally this commit also cleans up the snapshots for document and
question as there were quite a lot old unused snapshots.
Closes #360