blueprints: fix schema for meta models (#12421)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -126,7 +126,7 @@ class Command(BaseCommand):
|
|||||||
def_name_perm = f"model_{model_path}_permissions"
|
def_name_perm = f"model_{model_path}_permissions"
|
||||||
def_path_perm = f"#/$defs/{def_name_perm}"
|
def_path_perm = f"#/$defs/{def_name_perm}"
|
||||||
self.schema["$defs"][def_name_perm] = self.model_permissions(model)
|
self.schema["$defs"][def_name_perm] = self.model_permissions(model)
|
||||||
return {
|
template = {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["model", "identifiers"],
|
"required": ["model", "identifiers"],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -143,6 +143,11 @@ class Command(BaseCommand):
|
|||||||
"identifiers": {"$ref": def_path},
|
"identifiers": {"$ref": def_path},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
# Meta models don't require identifiers, as there's no matching database model to find
|
||||||
|
if issubclass(model, BaseMetaModel):
|
||||||
|
del template["properties"]["identifiers"]
|
||||||
|
template["required"].remove("identifiers")
|
||||||
|
return template
|
||||||
|
|
||||||
def field_to_jsonschema(self, field: Field) -> dict:
|
def field_to_jsonschema(self, field: Field) -> dict:
|
||||||
"""Convert a single field to json schema"""
|
"""Convert a single field to json schema"""
|
||||||
|
|||||||
@ -3884,8 +3884,7 @@
|
|||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"model",
|
"model"
|
||||||
"identifiers"
|
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"model": {
|
"model": {
|
||||||
@ -3915,9 +3914,6 @@
|
|||||||
},
|
},
|
||||||
"attrs": {
|
"attrs": {
|
||||||
"$ref": "#/$defs/model_authentik_blueprints.metaapplyblueprint"
|
"$ref": "#/$defs/model_authentik_blueprints.metaapplyblueprint"
|
||||||
},
|
|
||||||
"identifiers": {
|
|
||||||
"$ref": "#/$defs/model_authentik_blueprints.metaapplyblueprint"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user