Merge pull request #6192 from ostcar/models_field_groups

Add field group info in organization
This commit is contained in:
Finn Stutzenstein 2021-08-04 07:19:27 +02:00 committed by GitHub
commit ec00c6c7db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 832 additions and 133 deletions

View File

@ -202,6 +202,9 @@ class Checker:
def is_normal_field(self, field: str) -> bool: def is_normal_field(self, field: str) -> bool:
return "$" not in field return "$" not in field
def is_calculated_field(self, field: str) -> bool:
return field == "content"
def make_structured(self, field: str, replacement: Any) -> str: def make_structured(self, field: str, replacement: Any) -> str:
if type(replacement) not in (str, int): if type(replacement) not in (str, int):
@ -274,9 +277,14 @@ class Checker:
for x in self.models[collection].keys() for x in self.models[collection].keys()
if self.is_normal_field(x) or self.is_template_field(x) if self.is_normal_field(x) or self.is_template_field(x)
) )
calculated_fields = set(
x
for x in self.models[collection].keys()
if self.is_calculated_field(x)
)
errors = False errors = False
if collection_fields - model_fields: if collection_fields - model_fields - calculated_fields:
error = f"{collection}/{model['id']}: Missing fields {', '.join(collection_fields - model_fields)}" error = f"{collection}/{model['id']}: Missing fields {', '.join(collection_fields - model_fields)}"
self.errors.append(error) self.errors.append(error)
errors = True errors = True

File diff suppressed because it is too large Load Diff