mirror of
https://github.com/inventree/InvenTree.git
synced 2025-10-23 17:37:38 +00:00
refactor(backend): add enums for ordering fields (#10629)
* Add enums for ordering fields * add version bump
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
"""InvenTree API version information."""
|
"""InvenTree API version information."""
|
||||||
|
|
||||||
# InvenTree API version
|
# InvenTree API version
|
||||||
INVENTREE_API_VERSION = 413
|
INVENTREE_API_VERSION = 414
|
||||||
|
|
||||||
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
||||||
|
|
||||||
INVENTREE_API_TEXT = """
|
INVENTREE_API_TEXT = """
|
||||||
|
|
||||||
|
v414 -> 2025-06-20 : https://github.com/inventree/InvenTree/pull/10629
|
||||||
|
- Add enums for all ordering fields in schema - no functional changes
|
||||||
|
|
||||||
v413 -> 2025-10-20 : https://github.com/inventree/InvenTree/pull/10624
|
v413 -> 2025-10-20 : https://github.com/inventree/InvenTree/pull/10624
|
||||||
- Upstream fixes to django-allauth schema - no functional changes
|
- Upstream fixes to django-allauth schema - no functional changes
|
||||||
|
|
||||||
|
@@ -105,9 +105,11 @@ class ExtendedAutoSchema(AutoSchema):
|
|||||||
parameters = operation.get('parameters', [])
|
parameters = operation.get('parameters', [])
|
||||||
for parameter in parameters:
|
for parameter in parameters:
|
||||||
if parameter['name'] == 'ordering':
|
if parameter['name'] == 'ordering':
|
||||||
parameter['description'] = (
|
schema_order = []
|
||||||
f'{parameter["description"]} Possible fields: {", ".join(ordering_fields)}.'
|
for field in ordering_fields:
|
||||||
)
|
schema_order.append(field)
|
||||||
|
schema_order.append('-' + field)
|
||||||
|
parameter['schema']['enum'] = schema_order
|
||||||
|
|
||||||
# Add valid search fields to the search description.
|
# Add valid search fields to the search description.
|
||||||
search_fields = getattr(self.view, 'search_fields', None)
|
search_fields = getattr(self.view, 'search_fields', None)
|
||||||
|
Reference in New Issue
Block a user