Skip to content
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

Fix type resolution in sub execution #209

Merged
merged 6 commits into from
Jan 20, 2020

Conversation

adridadou
Copy link
Member

@adridadou adridadou commented Jan 13, 2020

It seems like when the parameter is not found, then the type returned is Text instead of ParameterType

This made issues in Collection definition.

This shows another issue that I need to look at but that's still an issue we need fixing

I'm not necessarily super happy with this solution (see #210 ) but it's clearly an improvement

This change is Reviewable

@adridadou adridadou marked this pull request as ready for review January 13, 2020 23:39
Copy link
Contributor

@fforbeck fforbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added two minor comments about the tests.

engine.execute(mainTemplate, TemplateParameters(), Map(TemplateSourceIdentifier(TemplateTitle("clause")) -> clauseTemplate,TemplateSourceIdentifier(TemplateTitle("clause")) -> clauseTemplate)) match {
case Right(result) =>
val variable = VariableDefinition(VariableName("Parties"), Some(VariableTypeDefinition("Collection",Some(VariableTypeDefinition("Parefhuzegfty Info",None)))))
getCollection(variable, result, "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding an assert here to check if the returned type is indeed a collection value type with the expected values? If the returned collection is empty, should it break the test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The collection will be empty because the internal format value is an empty string.
The test here is more to check that the call actually works, there was an issue with this call previously

}

def getCollection(variable:VariableDefinition, executionResult: TemplateExecutionResult, value:String):CollectionValue = {
println(variable.variableTypeDefinition)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can remove this println

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right

@adridadou adridadou merged commit 20cd570 into master Jan 20, 2020
@adridadou adridadou deleted the fix-type-resolution-in-sub-execution branch January 20, 2020 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants