idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.79k stars 1.05k forks source link

Minor SONDefinitionFormatter enhancements for NEAMS #17324

Closed brandonlangley closed 3 years ago

brandonlangley commented 3 years ago

Reason

A few minor updates are needed in the SONDefinitionFormatter to produce a more accurate NEAMS Workbench input schema:

  1. Currently, one declarator is produced per schema hierarchy level with a 'MinOccurs=1' rule signifying each is required.

    However if block name path notation is used, the generated hierarchical levels above the leaf do not have a declarator.

    The 'MinOccurs' rule adds no value to input validation or autocompletion assistance of declarators and can be withheld.

  2. New cpp_types such as Eigen::Matrix have been added to the JsonSyntaxTree as variable types for a few parameters.

    Unrecognized cpp_types currently emit a value node with a 'MaxOccurs=1' rule allowing only a single scalar value.

    However, variable types like Eigen::Matrix indicate that multiple values can belong to a parameter like an array.

    All cpp_types that indicate multiple values are allowed can instead emit a 'MaxOccurs=NoLimit' on the value node.

  3. Input array parameters are legally allowed to have zero values and also be defined as 'required' by the JsonSyntaxTree.

    The SONDefinitionFormatter currently points ChildAtLeastOne rule paths at 'value' children rather than parent contexts.

    So these 'required' arrays do exist in the input, but there are validation errors when they have zero 'value' children.

    The SONDefinitionFormatter should point the ChildAtLeastOne rule paths at parent contexts rather than 'value' children.

Design

A few lines in the SONDefinitionFormatter will be updated to address these input validation issues.

New RunApp tests will also be added to ensure these updates are in the produced schema as expected.

Impact

The NEAMS Workbench input validation and autocompletion assistance of MOOSE applications will become more reliable.

brandonlangley commented 3 years ago

@permcody -

I'm planning to open a small PR soon to make these SONDefinitionFormatter input validation improvements.

Could this be added to the FY 21 NEAMS Multiphysics Technical Assistance Support Project?