mirror of
https://github.com/inventree/InvenTree.git
synced 2025-10-14 21:22:20 +00:00
Add to serializers to fix missing return types in config/flags schema (#10486)
* Add serializer fields to fix missing return types in schema * Bump api version * Fix api version bump --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
"""InvenTree API version information."""
|
"""InvenTree API version information."""
|
||||||
|
|
||||||
# InvenTree API version
|
# InvenTree API version
|
||||||
INVENTREE_API_VERSION = 399
|
INVENTREE_API_VERSION = 400
|
||||||
|
|
||||||
"""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 = """
|
||||||
|
|
||||||
|
v400 -> 2025-10-05 : https://github.com/inventree/InvenTree/pull/10486
|
||||||
|
- Adds return datatypes for admin/config and flags entpoints
|
||||||
|
|
||||||
v399 -> 2025-10-05 : https://github.com/inventree/InvenTree/pull/10445
|
v399 -> 2025-10-05 : https://github.com/inventree/InvenTree/pull/10445
|
||||||
- Refactors 'customer_detail' param in SalesOrder API endpoint
|
- Refactors 'customer_detail' param in SalesOrder API endpoint
|
||||||
- Refactors 'customer_detail' param in ReturnOrder API endpoint
|
- Refactors 'customer_detail' param in ReturnOrder API endpoint
|
||||||
|
@@ -624,6 +624,9 @@ class FlagList(ListAPI):
|
|||||||
serializer_class = common.serializers.FlagSerializer
|
serializer_class = common.serializers.FlagSerializer
|
||||||
permission_classes = [AllowAnyOrReadScope]
|
permission_classes = [AllowAnyOrReadScope]
|
||||||
|
|
||||||
|
# Specifically disable pagination for this view
|
||||||
|
pagination_class = None
|
||||||
|
|
||||||
|
|
||||||
class FlagDetail(RetrieveAPI):
|
class FlagDetail(RetrieveAPI):
|
||||||
"""Detail view for an individual feature flag."""
|
"""Detail view for an individual feature flag."""
|
||||||
|
@@ -340,6 +340,12 @@ class ConfigSerializer(serializers.Serializer):
|
|||||||
This is a read-only serializer.
|
This is a read-only serializer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
key = serializers.CharField(read_only=True)
|
||||||
|
env_var = serializers.CharField(read_only=True, allow_null=True)
|
||||||
|
config_key = serializers.CharField(read_only=True, allow_null=True)
|
||||||
|
source = serializers.CharField(read_only=True)
|
||||||
|
accessed = serializers.DateTimeField(read_only=True)
|
||||||
|
|
||||||
def to_representation(self, instance):
|
def to_representation(self, instance):
|
||||||
"""Return the configuration data as a dictionary."""
|
"""Return the configuration data as a dictionary."""
|
||||||
if not isinstance(instance, str):
|
if not isinstance(instance, str):
|
||||||
@@ -406,6 +412,12 @@ class CustomStateSerializer(DataImportExportSerializerMixin, InvenTreeModelSeria
|
|||||||
class FlagSerializer(serializers.Serializer):
|
class FlagSerializer(serializers.Serializer):
|
||||||
"""Serializer for feature flags."""
|
"""Serializer for feature flags."""
|
||||||
|
|
||||||
|
key = serializers.CharField(read_only=True)
|
||||||
|
state = serializers.CharField(read_only=True)
|
||||||
|
conditions = serializers.ListField(
|
||||||
|
child=serializers.DictField(), read_only=True, allow_null=True
|
||||||
|
)
|
||||||
|
|
||||||
def to_representation(self, instance):
|
def to_representation(self, instance):
|
||||||
"""Return the configuration data as a dictionary."""
|
"""Return the configuration data as a dictionary."""
|
||||||
request = self.context.get('request')
|
request = self.context.get('request')
|
||||||
|
Reference in New Issue
Block a user