DashAI icon indicating copy to clipboard operation
DashAI copied to clipboard

Optimizable field validation

Open Riul1999 opened this issue 8 months ago • 0 comments

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 avatar Jun 18 '24 12:06 Riul1999