Skip to content
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

Add support for root validators. #20

Closed
roguh opened this issue Jun 7, 2021 · 4 comments
Closed

Add support for root validators. #20

roguh opened this issue Jun 7, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@roguh
Copy link

roguh commented Jun 7, 2021

Hello! Thank you for the great work.

I was wondering if you were planning on adding support for documenting root validators, like you do field validators.

@mansenfranzen mansenfranzen self-assigned this Jun 7, 2021
@mansenfranzen mansenfranzen added the enhancement New feature or request label Jun 7, 2021
@mansenfranzen
Copy link
Owner

Hi roguh,

thanks for your feature request. In my opinion it's a useful enhancement and I will add it as soon as I get some spare time. It was not yet planned (simply because it was not needed yet) but it should not be too difficult to implement. Feel free to add a PR yourself if you want. Otherwise you might need to wait a week or two.

If you have some concrete ideas about how root validators should be documented, feel free to share them here. In fact, there is mainly the validator name, doc string, and optional parameters. Additionally, there should be a distinction being made between field and root validators in the documentation. Perhaps root validators should get a custom prefix like root validator.

@mansenfranzen
Copy link
Owner

@roguh I added support for @root_validator. Here is an example of how they are represented along with standard validators validating all fields @validator("*"): documentation preview.

Essentially, root validators are pretty much the same as standard validators which validate all fields. Hence, they are treated the identically within the sphinx documentation. I don't think there is additional value distinguishing them in the documentation (in contrast to what I've had in mind before).

Please feel free to comment.

@mansenfranzen
Copy link
Owner

@roguh I'm closing this issue for now with the current release v1.3.1. Feel free to reopen if you have any additional comments. Cheers.

@roguh
Copy link
Author

roguh commented Nov 6, 2021

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants