You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We'd like to create smaller simpler schemas that can be combined into larger and more complex schemas.
Describe the solution you'd like
Consider the following schema files (must be present at config_validation_engine/schemas):
create a new python package called schema in the root dir
create a new python class called SchemaElement
create a new python class called Schema
The SchemaElement class can be used as a wrapper for all the yaml files that represent smaller schemas for various components of a site level configuration file.
This action must be performed by a new class or function called SchemaBuilder or schema_builder.
The schema builder must account for dependencies created due to the include() function present in yamale. It should make sure that if a schema file contains a line that includes 'some_other_schema', then in the final output file some_other_schema must be present after the current schema file.
Ideally, there must not be any cyclic dependencies present in the schemas. We shall discover it along the way.
A mechanism to resolve dependencies could be (up for debate ;) ):
We can parse all the schema files and segregate them in lists.
If a schema file has 0 include() statements, then we add it to a list called statum0 (i.e it has 0 modalities).
If a schema file has 1 include() statement and the included schema has 0 include statements, then we add it to a list called stratum 1 (i.e. it has modality=1).
If a schema file has 1 include() statement and the included schema also has 1 include statement, then we add the parent schema file to a list called stratum2 (i.e. it has modality = 2).
If a schema file has 2 include() statements and the included schemas are stratum0's, then we add it to the list called stratum2 (modality = 2).
If a schema file has 2 include() statements and one of the included schemas is a stratum1 while the other is a stratum0, then we add it to stratum(2 + 1) i.e. stratum3 list.
If a file has n include statements and the included schema file has modalities x1, x2, x3,..., xn respectively, then the file must belong to the stratum(n + x1 + x2 + ... + xn) list.
We can then create an ordered sequence such that elements in stratum0 appear before elements in stratum1 and so on..
For the schemas in the same stratum (>0), if a schema has any include() statements that refer to another schema in the same stratum, the current schema should be present before the other schema.
Once we have the ordered list, the final output essentially should be a rendered yaml file in the same sequence.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
At present, we are writing the output of schema builder by hand as described in #4
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
We'd like to create smaller simpler schemas that can be combined into larger and more complex schemas.
Describe the solution you'd like
Consider the following schema files (must be present at config_validation_engine/schemas):
Filename: lightweight_component.schema
Filename: voms_config.schema
Filename: pool_account.schema
and so on....
We'd like to generate a schema file as follows:
To achieve this funcionality, we can
The SchemaElement class can be used as a wrapper for all the yaml files that represent smaller schemas for various components of a site level configuration file.
This action must be performed by a new class or function called SchemaBuilder or schema_builder.
The schema builder must account for dependencies created due to the include() function present in yamale. It should make sure that if a schema file contains a line that includes 'some_other_schema', then in the final output file some_other_schema must be present after the current schema file.
Ideally, there must not be any cyclic dependencies present in the schemas. We shall discover it along the way.
A mechanism to resolve dependencies could be (up for debate ;) ):
We can parse all the schema files and segregate them in lists.
If a schema file has 0 include() statements, then we add it to a list called statum0 (i.e it has 0 modalities).
If a schema file has 1 include() statement and the included schema has 0 include statements, then we add it to a list called stratum 1 (i.e. it has modality=1).
If a schema file has 1 include() statement and the included schema also has 1 include statement, then we add the parent schema file to a list called stratum2 (i.e. it has modality = 2).
If a schema file has 2 include() statements and the included schemas are stratum0's, then we add it to the list called stratum2 (modality = 2).
If a schema file has 2 include() statements and one of the included schemas is a stratum1 while the other is a stratum0, then we add it to stratum(2 + 1) i.e. stratum3 list.
If a file has n include statements and the included schema file has modalities x1, x2, x3,..., xn respectively, then the file must belong to the stratum(n + x1 + x2 + ... + xn) list.
We can then create an ordered sequence such that elements in stratum0 appear before elements in stratum1 and so on..
For the schemas in the same stratum (>0), if a schema has any include() statements that refer to another schema in the same stratum, the current schema should be present before the other schema.
Once we have the ordered list, the final output essentially should be a rendered yaml file in the same sequence.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
At present, we are writing the output of schema builder by hand as described in #4
The text was updated successfully, but these errors were encountered: