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

feat: valid Pydantic #373

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core/cat/db/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,7 @@ def upsert_setting_by_name(payload: models.Setting) -> models.Setting:
query = Query()
get_db().update(payload, query.name == payload.name)

return get_setting_by_name(payload.name)
return get_setting_by_name(payload.name)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with the utility of a validate_presences method, but it is not related to DB crud.
I would move it here in the factory, where schemas are defined, or in utilis in case we'll use this validation method also for plugin settings. Also infrastructure could be a place for this method, if we go for a validation set of methods

What do you think?

def validate_presences(required: list, payload: dict):
return len([req for req in required if req not in payload]) > 0
Empty file.
Empty file.
Empty file.
Loading