diff --git a/authentik/admin/api/tasks.py b/authentik/admin/api/tasks.py index 63c82394d..d3abd5dea 100644 --- a/authentik/admin/api/tasks.py +++ b/authentik/admin/api/tasks.py @@ -24,9 +24,10 @@ class TaskSerializer(Serializer): task_description = CharField() task_finish_timestamp = DateTimeField(source="finish_timestamp") - status = ChoiceField(source="result.status.name", choices=[ - (x.name, x.name) for x in TaskResultStatus - ]) + status = ChoiceField( + source="result.status.name", + choices=[(x.name, x.name) for x in TaskResultStatus], + ) messages = ListField(source="result.messages") def create(self, validated_data: dict) -> Model: diff --git a/authentik/api/v2/config.py b/authentik/api/v2/config.py index 012f20574..82c055fcd 100644 --- a/authentik/api/v2/config.py +++ b/authentik/api/v2/config.py @@ -1,10 +1,11 @@ """core Configs API""" from django.db.models import Model from drf_yasg2.utils import swagger_auto_schema +from rest_framework.fields import BooleanField, CharField from rest_framework.permissions import AllowAny from rest_framework.request import Request from rest_framework.response import Response -from rest_framework.serializers import ReadOnlyField, Serializer +from rest_framework.serializers import Serializer from rest_framework.viewsets import ViewSet from authentik.lib.config import CONFIG @@ -13,12 +14,12 @@ from authentik.lib.config import CONFIG class ConfigSerializer(Serializer): """Serialize authentik Config into DRF Object""" - branding_logo = ReadOnlyField() - branding_title = ReadOnlyField() + branding_logo = CharField(read_only=True) + branding_title = CharField(read_only=True) - error_reporting_enabled = ReadOnlyField() - error_reporting_environment = ReadOnlyField() - error_reporting_send_pii = ReadOnlyField() + error_reporting_enabled = BooleanField(read_only=True) + error_reporting_environment = CharField(read_only=True) + error_reporting_send_pii = BooleanField(read_only=True) def create(self, validated_data: dict) -> Model: raise NotImplementedError @@ -32,7 +33,7 @@ class ConfigsViewSet(ViewSet): permission_classes = [AllowAny] - @swagger_auto_schema(responses={200: ConfigSerializer(many=True)}) + @swagger_auto_schema(responses={200: ConfigSerializer(many=False)}) def list(self, request: Request) -> Response: """Retrive public configuration options""" config = ConfigSerializer( diff --git a/swagger.yaml b/swagger.yaml index 90533ee0a..25d5741ae 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -5841,10 +5841,7 @@ paths: '200': description: Serialize authentik Config into DRF Object schema: - description: '' - type: array - items: - $ref: '#/definitions/Config' + $ref: '#/definitions/Config' tags: - root parameters: [] @@ -11815,21 +11812,24 @@ definitions: title: Branding logo type: string readOnly: true + minLength: 1 branding_title: title: Branding title type: string readOnly: true + minLength: 1 error_reporting_enabled: title: Error reporting enabled - type: string + type: boolean readOnly: true error_reporting_environment: title: Error reporting environment type: string readOnly: true + minLength: 1 error_reporting_send_pii: title: Error reporting send pii - type: string + type: boolean readOnly: true Source: description: Source Serializer