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

Optimizable field validation #222

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

Conversation

Riul1999
Copy link
Collaborator

Summary

Add fields validation to optmizable int and float fields.

Type of change

  • Back end new feature.
  • Refactoring.

Changes

  • Created OptimizableIntField and OptimizableFloatField to structure the input dict, this classes define the required keys of the dictionary and their types.
  • Added __check_order_factory to check the order constraints defined in the type.
  • Added __check_bound_order to check that the lower_bound is less or equal than the upper bound.
  • Refactored optimizer_int_field and optimizer_float_field to use the new classes and validators.
  • Refactored FormSchemaFields component, now uses the type of the fixed_value (if it has the field) to determine if the field is an optimizable integer or float.
  • Created test_optimized_schemas test file to check the correct behavior of the optmizable fields. It checks the shape of the generated json schema, the type constraints and the order constrainst.

How to Test

Run pytest .\tests\back\schemas\test_optimized_schemas.py.

@Riul1999 Riul1999 added enhancement New feature or request front Frontend work back Backend work refactor Prune and embelish code labels Jun 18, 2024
@Riul1999 Riul1999 self-assigned this Jun 18, 2024
@Riul1999 Riul1999 requested a review from CVelizR June 18, 2024 12:21
Base automatically changed from test/ut-may-2024 to develop July 10, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back Backend work enhancement New feature or request front Frontend work refactor Prune and embelish code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant