mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
Workflows: Add RimWorkflowVec3Binding for Vec3-typed config fields
Recognizes Vec3-shaped object schemas ({x, y, z} number properties)
structurally in RimWorkflowDescribeTools and dispatches them to a new
RimWorkflowVec3Binding in RimWorkflowTaskInput::createBinding(). Stores
the value as a cvf::Vec3d field, parses JSON object defaults, and emits
a YAML flow-mapping ({x: .., y: .., z: ..}) matching the taskmaestro
Vec3 pydantic model shape.
This commit is contained in:
1 parent
65942d455d
commit
9bfd91df90
8 files changed
+181
-1
No files matched your search
@@ -119,6 +119,35 @@ TEST( RimWorkflowDescribeTools, resinsightObjectFields )
|
||||
EXPECT_FALSE( fieldByName( greetA, "name" ).contains( "resinsight_type" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// taskmaestro_resinsight.models.Vec3 is a plain pydantic model (x, y, z numbers) with no
|
||||
/// x-taskmaestro-python-type tag, so it must be recognized structurally.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST( RimWorkflowDescribeTools, vec3FieldIsRecognizedStructurally )
|
||||
{
|
||||
const QJsonObject vec3Schema{ { "title", "Vec3" },
|
||||
{ "type", "object" },
|
||||
{ "properties",
|
||||
QJsonObject{ { "x", QJsonObject{ { "title", "X" }, { "type", "number" } } },
|
||||
{ "y", QJsonObject{ { "title", "Y" }, { "type", "number" } } },
|
||||
{ "z", QJsonObject{ { "title", "Z" }, { "type", "number" } } } } },
|
||||
{ "required", QJsonArray{ "x", "y", "z" } } };
|
||||
|
||||
const QJsonObject describe{ { "workflow", "well_path" },
|
||||
{ "tasks",
|
||||
QJsonArray{ QJsonObject{ { "name", "create_well_path" },
|
||||
{ "config_fields", QJsonArray{ "reference_point" } },
|
||||
{ "input_schema",
|
||||
QJsonObject{ { "properties", QJsonObject{ { "reference_point", vec3Schema } } },
|
||||
{ "required", QJsonArray{ "reference_point" } } } } } } } };
|
||||
|
||||
const QJsonObject graph = RimWorkflowDescribeTools::graphFromDescribe( describe );
|
||||
const QJsonObject referencePoint = fieldByName( taskByName( graph, "create_well_path" ), "reference_point" );
|
||||
EXPECT_EQ( "object", referencePoint.value( "type" ).toString() );
|
||||
EXPECT_EQ( "Vec3", referencePoint.value( "resinsight_type" ).toString() );
|
||||
EXPECT_TRUE( referencePoint.value( "required" ).toBool() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST( RimWorkflowDescribeTools, dependencyEdges )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user