aac.plugins.check.check_aac_impl¶
The AaC Check AaC plugin implementation module.
Functions
|
Checks relevant constraints for given definition(s). |
|
Helper method that runs context constraints against a given schema. |
|
Helper method that runs all the constraints for a given primitive. |
|
Helper method that runs all the constraints for a given schema. |
- aac.plugins.check.check_aac_impl.check(aac_file: str, fail_on_warn: bool, verbose: bool) ExecutionResult [source]¶
Checks relevant constraints for given definition(s). Runs context constraints (global constraints), then runs schema constraints (specifically assigned constraints). Primitive constraints are ran as a part of schema constraints.
- Parameters:
aac_file (str) – The AaC file being processed
fail_on_warn (bool) – Flag to fail when warnings are discovered
verbose (bool) – Flag for verbose mode. When true add success messages as encountered.
- Returns:
- Method result containing: plugin_name (“Check AaC”), “check”, status, message
including results from lower level helper methods
- Return type:
- Raises:
LanguageError – Passed up LanguageError from get_defining_schema_for_root
- aac.plugins.check.check_aac_impl.check_context_constraint(context_constraint: Definition, definitions_to_check: list[Definition], all_constraints_by_name: dict[str, Callable], constraint_results: dict[str, list[ExecutionResult]]) dict[str, list[ExecutionResult]] [source]¶
Helper method that runs context constraints against a given schema.
- Parameters:
context_constraint (Definition) – The constraint being checked against.
definitions_to_check (list[Definition]) – A list of definitions to check against the constraint.
all_constraints_by_name (dict[str, Callable]) – A dictionary of all constraint names and function calls.
constraint_results (dict[str, list[ExecutionResult]]) – A dictionary of constraint results.
- Returns:
An updated dictionary of constraint results.
- Return type:
dict[str, list[ExecutionResult]]
- aac.plugins.check.check_aac_impl.check_primitive_constraint(field: Any, source_definition: Definition, value_to_check: Any, primitive_declaration: str, defining_primitive, all_constraints_by_name: dict[str, Callable], constraint_results: dict[str, list[ExecutionResult]]) dict[str, list[ExecutionResult]] [source]¶
Helper method that runs all the constraints for a given primitive.
- Parameters:
field (Any) – The field being checked
source_definition (Definition) – Source of the check_me field that we are evaluating
value_to_check (Any) – The field value being checked
primitive_declaration (str) – The declaration of the primitive
defining_primitive – The defining primitive constraints
all_constraints_by_name (dict[str, Callable]) – A dictionary of all constraint names and function calls.
constraint_results (dict[str, list[ExecutionResult]]) – A dictionary of constraint results.
- Returns:
An updated dictionary of constraint results.
- Return type:
dict[str, list[ExecutionResult]]
- aac.plugins.check.check_aac_impl.check_schema_constraint(source_definition: Definition, check_me: Any, check_against: Definition, all_constraints_by_name: dict[str, Callable], constraint_results: dict[str, list[ExecutionResult]]) dict[str, list[ExecutionResult]] [source]¶
Helper method that runs all the constraints for a given schema.
- Parameters:
source_definition (Definition) – Source of the check_me field that we are evaluating
check_me (Any) – The field being checked
check_against (Definition) – The schema we are comparing the check_me field against
all_constraints_by_name (dict[str, Callable]) – A dictionary of all constraint names and function calls.
constraint_results (dict[str, list[ExecutionResult]]) – A dictionary of constraint results.
- Returns:
An updated dictionary of constraint results.
- Return type:
dict[str, list[ExecutionResult]]
- Raises:
LanguageError – If unique schema definition for field type not found for field name
LanguageError – If value of field name was something other than a list