diff --git a/authentik/blueprints/management/commands/make_blueprint_schema.py b/authentik/blueprints/management/commands/make_blueprint_schema.py index 1ac014858..5ca5d4eca 100644 --- a/authentik/blueprints/management/commands/make_blueprint_schema.py +++ b/authentik/blueprints/management/commands/make_blueprint_schema.py @@ -10,7 +10,7 @@ from rest_framework.serializers import Serializer from structlog.stdlib import get_logger from authentik.blueprints.v1.importer import SERIALIZER_CONTEXT_BLUEPRINT, is_model_allowed -from authentik.blueprints.v1.meta.registry import registry +from authentik.blueprints.v1.meta.registry import BaseMetaModel, registry from authentik.lib.models import SerializerModel LOGGER = get_logger() @@ -74,14 +74,18 @@ class Command(BaseCommand): def build(self): """Build all models into the schema""" for model in registry.get_models(): - if model._meta.abstract: - continue - if not is_model_allowed(model): - continue - model_instance: Model = model() - if not isinstance(model_instance, SerializerModel): - continue - serializer = model_instance.serializer( + if issubclass(model, BaseMetaModel): + serializer_class = model.serializer() + else: + if model._meta.abstract: + continue + if not is_model_allowed(model): + continue + model_instance: Model = model() + if not isinstance(model_instance, SerializerModel): + continue + serializer_class = model_instance.serializer + serializer = serializer_class( context={ SERIALIZER_CONTEXT_BLUEPRINT: False, } diff --git a/blueprints/schema.json b/blueprints/schema.json index 96e95a387..ea4c2a386 100644 --- a/blueprints/schema.json +++ b/blueprints/schema.json @@ -2560,6 +2560,42 @@ "$ref": "#/$defs/model_authentik_core.token" } } + }, + { + "type": "object", + "required": [ + "model", + "identifiers" + ], + "properties": { + "model": { + "const": "authentik_blueprints.metaapplyblueprint" + }, + "id": { + "type": "string" + }, + "state": { + "type": "string", + "enum": [ + "absent", + "present", + "created" + ], + "default": "present" + }, + "conditions": { + "type": "array", + "items": { + "type": "boolean" + } + }, + "attrs": { + "$ref": "#/$defs/model_authentik_blueprints.metaapplyblueprint" + }, + "identifiers": { + "$ref": "#/$defs/model_authentik_blueprints.metaapplyblueprint" + } + } } ] } @@ -8314,6 +8350,21 @@ } }, "required": [] + }, + "model_authentik_blueprints.metaapplyblueprint": { + "type": "object", + "properties": { + "identifiers": { + "type": "object", + "additionalProperties": true, + "title": "Identifiers" + }, + "required": { + "type": "boolean", + "title": "Required" + } + }, + "required": [] } } }