Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[0.8] - Functions, Errors, Events objects are marshaling into YAML/JSON with ref attributes instead of actual object #603

Open
Assignees
ricardozanini
Labels
@ricardozanini

Description

@ricardozanini

What happened:

Given the following builder:

publicclassWorkFlowBuilder {publicWorkflowbuildWorkFlow()throwsJsonProcessingException {ObjectMappermapper =newObjectMapper();JsonNodesendOrderArgs =mapper.readTree("""                {                  "supplier-id": "1",                  "content": ".orderId",                  "locator": ".reference"                }                """);JsonNodeprintMessageArgs =mapper.readTree("""                {                  "message": "\\"Order received:\\" + .orderId",                  "locator": ".reference"                }                """);// Define Function DefinitionsFunctionDefinitionsendOrderFunction =newFunctionDefinition()                .withName("sendOrder")                .withOperation("specs/sendOrderOpenApi.yaml#sendOrder")                .withType(FunctionDefinition.Type.CUSTOM);FunctionDefinitionprintMessageFunction =newFunctionDefinition()                .withName("printMessage")                .withOperation("specs/printMessage.yaml#printMessage")                .withType(FunctionDefinition.Type.CUSTOM);// Define ActionsActionsendOrderAction =newAction()                .withName("sendOrder")                .withFunctionRef(newio.serverlessworkflow.api.functions.FunctionRef()                        .withRefName("sendOrder")                        .withArguments(sendOrderArgs)                        .withInvoke(FunctionRef.Invoke.SYNC))                .withRetryRef("defaultRetry")                .withRetryableErrors(List.of("Internal Server error","Bad Gateway","Service Unavailable","Gateway timeout","Insufficient storage","Locked"                ))                .withNonRetryableErrors(List.of());ActionprintMessageAction =newAction()                .withName("printMessage")                .withFunctionRef(newio.serverlessworkflow.api.functions.FunctionRef()                        .withRefName("printMessage")                        .withArguments(printMessageArgs)                        .withInvoke(FunctionRef.Invoke.SYNC))                .withRetryRef("defaultRetry")                .withRetryableErrors(sendOrderAction.getRetryableErrors())                .withNonRetryableErrors(List.of());// Define StateOperationStateorderReceivedState =newOperationState()                .withName("Order Received")                .withType(DefaultState.Type.OPERATION)                .withActionMode(OperationState.ActionMode.SEQUENTIAL)                .withActions(List.of(sendOrderAction,printMessageAction))                .withUsedForCompensation(false)                .withEnd(newEnd().withTerminate(true).withProduceEvents(List.of()).withCompensate(false))                .withOnErrors(List.of());Functionsfunctions =newFunctions();functions.setFunctionDefs(List.of(sendOrderFunction,printMessageFunction));Errorserrors =newErrors();errors.setRefValue("specs/errors.yaml");// Build WorkflowreturnnewWorkflow()                .withId("order")                .withName("Order Workflow")                .withDescription("Order Workflow Sample")                .withVersion("1.0")                .withStart(newStart().withStateName("Order Received"))                .withExpressionLang("jq")                .withKeepActive(false)                .withAutoRetries(false)                .withFunctions(functions)                .withErrors(errors)                .withStates(List.of(orderReceivedState))                .withExtensions(List.of());    }}

Would marshal the functions and errors as:

functions:refValue:nullfunctionDefs:    -name:"sendOrder"operation:"specs/sendOrderOpenApi.yaml#sendOrder"type:"custom"    -name:"printMessage"operation:"specs/printMessage.yaml#printMessage"type:"custom"errors:refValue:"specs/errors.yaml"errorDefs:null

There's a clear problem with how the marshallers processanyOf attributes within the JSON Schema.

What you expected to happen:

The output should be:

functions:  -name:"sendOrder"operation:"specs/sendOrderOpenApi.yaml#sendOrder"type:"custom"  -name:"printMessage"operation:"specs/printMessage.yaml#printMessage"type:"custom"errors:  -"specs/errors.yaml"

Null objects should also be ignored.

How to reproduce it:

Run the givenWorkflowBuilder

Anything else we need to know?:

Whole output of the following builder:

id:"order"name:"Order Workflow"description:"Order Workflow Sample"version:"1.0"annotations:[]start:stateName:"Order Received"expressionLang:"jq"keepActive:falseautoRetries:falsefunctions:refValue:nullfunctionDefs:    -name:"sendOrder"operation:"specs/sendOrderOpenApi.yaml#sendOrder"type:"custom"    -name:"printMessage"operation:"specs/printMessage.yaml#printMessage"type:"custom"errors:refValue:"specs/errors.yaml"errorDefs:nullstates:  -actionMode:"sequential"actions:      -name:"sendOrder"functionRef:refName:"sendOrder"arguments:supplier-id:"1"content:".orderId"locator:".reference"invoke:"sync"retryRef:"defaultRetry"nonRetryableErrors:[]retryableErrors:          -"Internal Server error"          -"Bad Gateway"          -"Service Unavailable"          -"Gateway timeout"          -"Insufficient storage"          -"Locked"      -name:"printMessage"functionRef:refName:"printMessage"arguments:message:"\"Order received:\" + .orderId"locator:".reference"invoke:"sync"retryRef:"defaultRetry"nonRetryableErrors:[]retryableErrors:          -"Internal Server error"          -"Bad Gateway"          -"Service Unavailable"          -"Gateway timeout"          -"Insufficient storage"          -"Locked"usedForCompensation:falsename:"Order Received"type:"operation"end:terminate:trueproduceEvents:[]compensate:falseonErrors:[]extensions:[]

Environment:

  • Specification version used: 0.8

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp