2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-04-15 07:48:51 +00:00
Files
InvenTree/src
Oliver 40b67f5f12 [API] Filter refactor (#11073)
* Lazy evaluation of optional serializer fields

- Add OptionalField dataclass
- Pass serializer class and kwargs separately

* Refactor BuildLineSerializer class

* Simplify gathering

* Refactor BuildSerializer

* Refactor other Build serializers

* Refactor Part serializers

* Refactoring more serializers to use OptionalField

* More refactoring

* Cleanup for mixin class

* Ensure any optional fields we added in are not missed

* Fixes

* Rehydrate optional fields for metadata

* Add TreePathSerializer class

* Further improvements:

- Handle case where optional field shadows model property
- Consider read_only and write_only fields

* Adjust unit tests

* Fix for "build_relational_field"

- Handle case where optional field shadows model relation

* Fix case where multiple fields can share same filter

* additional unit tests

* Bump API version

* Remove top-level detection

- Request object is only available for the top-level serializer anyway

* Cache serializer to prevent multiple __init__ calls

* Revert caching change

- Breaks search results

* Simplify field removal

* Adjust unit test

* Remove docstring comment which is no longer true

* Ensure read-only fields are skipped for data import

* Use SAFE_METHODS

* Do not convert to lowercase

* Updated docstring

* Remove FilterableSerializerField mixin

- Annotation now performed using OptionalField
- Code can be greatly simplified

* Ensure all fields are returned when generating schema

* Fix order of operations

* Add assertion to unit test

* fix style

* Fix api_version

* Remove duplicate API entries

* Remove duplicate API entries

* Fix formatting in api_version.py

* Tweak ManufacturerPart serializer

* Revert formatting change

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
2026-04-12 10:50:29 +10:00
..
2026-04-12 10:50:29 +10:00