-
Notifications
You must be signed in to change notification settings - Fork 50
Change to not initialize collections by default on generated POJOs #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change to not initialize collections by default on generated POJOs #206
Conversation
Signed-off-by: Helber Belmiro <[email protected]>
Can you show what the resulting json (Workflow.toJson(workflow)) looks like with this change? |
When {
"id" : "functionrefs",
"name" : "Customer Credit Check Workflow",
"description" : "Perform Customer Credit Check",
"version" : "1.0",
"start" : "TestFunctionRef",
"specVersion" : "0.8",
"expressionLang" : "jq",
"events" : [ ],
"functions" : [ {
"name" : "creditCheckFunction",
"operation" : "http://myapis.org/creditcheckapi.json#doCreditCheck",
"type" : "rest"
}, {
"name" : "sendRejectionEmailFunction",
"operation" : "http://myapis.org/creditcheckapi.json#rejectionEmail",
"type" : "rest"
} ],
"retries" : [ ],
"errors" : [ ],
"secrets" : [ ],
"states" : [ {
"actionMode" : "sequential",
"actions" : [ {
"functionRef" : "creditCheckFunction"
}, {
"functionRef" : {
"refName" : "sendRejectionEmailFunction",
"arguments" : {
"applicant" : "${ .customer }"
},
"invoke" : "sync"
}
} ],
"usedForCompensation" : false,
"name" : "TestFunctionRefs",
"type" : "operation",
"end" : true
} ]
} When {
"id" : "functionrefs",
"name" : "Customer Credit Check Workflow",
"description" : "Perform Customer Credit Check",
"version" : "1.0",
"start" : "TestFunctionRef",
"specVersion" : "0.8",
"events" : [ ],
"functions" : [ {
"name" : "creditCheckFunction",
"operation" : "http://myapis.org/creditcheckapi.json#doCreditCheck",
"type" : "rest"
}, {
"name" : "sendRejectionEmailFunction",
"operation" : "http://myapis.org/creditcheckapi.json#rejectionEmail",
"type" : "rest"
} ],
"retries" : [ ],
"errors" : [ ],
"secrets" : [ ],
"states" : [ {
"actionMode" : "sequential",
"actions" : [ {
"functionRef" : "creditCheckFunction"
}, {
"functionRef" : {
"refName" : "sendRejectionEmailFunction",
"arguments" : {
"applicant" : "${ .customer }"
},
"invoke" : "sync"
}
} ],
"usedForCompensation" : false,
"name" : "TestFunctionRefs",
"type" : "operation",
"end" : true
} ]
} There's only one difference: |
sdk-java/api/src/main/java/io/serverlessworkflow/api/serializers/WorkflowSerializer.java Line 66 in 8a61e3c
|
if its null or empty it should not be spit out as json/yaml |
we need tests that round-trip markup it seems ...will add |
Reverted to draft to investigate the jq issue. |
jq is the default value if its not in json/yaml so this should be ok imo the markup that sdk spits out from object model imo does not 100% have to match the original user markup (for example default prop values and empty arrays can be omitted) , but it has to be semantically the same (and it has to be validatable if original was too) |
Yes. Makes sense. |
@tsurdilo Just to clarify, you need to add these tests before we move on with this PR? |
Yes, I'm updating all tests to make sure the json+yaml outputs are validated. This could help us figure out all possible issues the code might have right now and then we can look how to handle them. Hope thats ok with you. |
@tsurdilo did you manage to update the tests you mention above so we can move this PR forward? |
Fixes #204.
Changes:
false
initializeCollections
tofalse