Skip to content

feat: add custom marshmallow validation#1438

Open
Lopa10ko wants to merge 30 commits into
refactor/fedot_1.0.0from
feature/validation-module
Open

feat: add custom marshmallow validation#1438
Lopa10ko wants to merge 30 commits into
refactor/fedot_1.0.0from
feature/validation-module

Conversation

@Lopa10ko

@Lopa10ko Lopa10ko commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Context

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

All PEP8 errors has been fixed, thanks ❤️

Comment last updated at Thu, 25 Jun 2026 13:52:40

@Lopa10ko

Lopa10ko commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

/fix-pep8


top_level_field = field_path.split('.')[0]
default_value = get_field_default(schema, top_level_field)
if default_value is None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What if None is default?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

great question.
maybe it's time to revise all defaults and instead of allowing None as a default value, we could suggest an alternative, such as a custom FedotNone type.

please note that this PR is just a draft for implementing a robust validation layer, not the final solution – use it if it suits your needs in your specific tasks

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FedotNone is a good solution, I think.

@Romankkl03

Copy link
Copy Markdown
Collaborator

Is it correct to be able to replace incorrectly set values with default values?

@Romankkl03

Copy link
Copy Markdown
Collaborator

Now the user can work both through the API and directly through TD_Creator. In this case, where should the source of truth for parameter validation be located — at the API level, at the TD_Creator level, or in the common schema/validation function that both layers use? I want to avoid duplication of rules, but at the same time maintain correct validation for both usage methods.

@Lopa10ko

Copy link
Copy Markdown
Collaborator Author

Now the user can work both through the API and directly through TD_Creator. In this case, where should the source of truth for parameter validation be located — at the API level, at the TD_Creator level, or in the common schema/validation function that both layers use? I want to avoid duplication of rules, but at the same time maintain correct validation for both usage methods.

the ultimate source of validation lies in marshmallow schemas.
you can establish your validation policies in the TD_Creator space and then apply them to API parameters using these schemas imports

@Lopa10ko

Copy link
Copy Markdown
Collaborator Author

Is it correct to be able to replace incorrectly set values with default values?

yes, with strict_validation=True, this behavior is flexible and open to debate

@RodionChugunov

Copy link
Copy Markdown

/fix-pep8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants