Add field restriction_mode to every collectionfield
This commit is contained in:
parent
7c6fe46946
commit
552ac0f9d3
@ -203,6 +203,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):
|
||||||
raise CheckException(
|
raise CheckException(
|
||||||
@ -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
|
||||||
|
951
docs/models.yml
951
docs/models.yml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user